Difference between EUID and UID?

Arun Chettoor picture Arun Chettoor · Dec 27, 2014 · Viewed 30.2k times · Source

EUID is not the same as UID. At what context are these both are used in the script?

I tried to get the values by echo "UID is $UID and EUID is $EUID", but only space came as output. My machine runs Ubuntu 12.04 LTS. Seen at some sites that this is usually used to check whether it is root user and all but not able to get proper difference.

Answer

Barmar picture Barmar · Dec 27, 2014

They're different when a program is running set-uid. Effective UID is the user you changed to, UID is the original user.