Processes Credentials
- Note that owner of the process != owner of the program
User ID (UID
) and Group ID (GID
)
- Every user has a unique login name and an associated numeric user identifier (
UID
). - Users can belong to one or more groups. Each group also has a unique
name and a group identifier (
GID
).
Real User ID (RUID
) and Real Group ID (RGID
)
- The real user ID and group ID identify the user and group to which the process belongs (the UserID of the user that started the process)
- In our shell, every process that we’ll now run will inherit the privileges of my user account and will run with the same UID and GID.
- In this case, those are the
RUID
andGUID
of the process (not the program)
Effective User ID (EUID
) and Effective Group ID (EGID
)
-
EUID
determines the permissions that the process has while executing a particular task. -
It can change during the execution of a process, allowing the process to temporarily gain additional permissions beyond those granted by the real
UID
. -
By default,
EUID
andEGID
are the same asRUID
andRGID
. But asetuid
program may run withEUID
that differs from itsRUID
, enabling it to perform tasks that require higher privileges for specific operations. -
Let take
passwd
program as an example:
-
Notice the ‘s’ letter instead of ‘x’ in the owner part of the file permission. This is a special permission bit for specific binary executable files which is known as
setuid
. -
When a
setuid
binary likepasswd
executes, the process changes itsEUID
(from the defaultRUID
) to the owner of this special binary executable (root
in this case).- The process
passwd
is run as root user
- The process