Unix-like operating systems identify a user within the kernel by a value called a user identifier, often abbreviated to user ID or UID. The UID, along with the group identifier (GID) and other access control criteria, is used to determine which system resources a user can access. The password file maps textual user names to UIDs, but in the kernel, only UIDs are used. UIDs are stored in the inodes of the Unix file system, running processes, tar archives, and the now-obsolete Network Information Service. In POSIX-compliant environments, the command-line command id
gives the current user's UID, as well as more information such as the user name, primary user group and group identifier (GID).
The POSIX standard introduced three different UID fields into the process descriptor table, to allow privileged processes to take on different roles dynamically:
The effective UID (euid
) of a process is used for most access checks. It is also used as the owner for files created by that process. The effective GID (egid
) of a process also affects access control and may also affect file creation, depending on the semantics of the specific kernel implementation in use and possibly the mount options used. According to BSD Unix semantics, the group ownership given a newly created file is unconditionally inherited from the group ownership of the directory in which it is created. According to AT&T UNIX System V semantics (also adopted by Linux variants) newly created files will normally be given the group ownership of the egid
of the process that creates them. Most filesystems implement a method to select whether BSD or AT&T semantics should be used regarding group ownership of newly created files, BSD semantics is selected for specific directories in case that the S_ISGID (s-gid) permission is set.