Linux Users, Groups, and Permissions
Linux identifies people and services with numeric user and group IDs. File ownership and permission rules use those IDs to decide which processes may read, change, execute, or traverse filesystem objects.
itLinux | OpenSkills.info
Intro
Linux Users, Groups, and Permissions
Linux makes access decisions for processes, not for names typed at a login prompt. Each process carries credentials that include user IDs, group IDs, and supplementary groups. Filesystem objects carry an owner user ID, an owner group ID, and a mode. The kernel compares the process credentials with that metadata when it checks ordinary discretionary access.
Account names make numeric identities usable for people and administrators. A local /etc/passwd entry maps a login name to a user ID, primary group ID, home directory, and login shell. The public account record normally contains an x in its password field. Password hashes reside in /etc/shadow, which has tighter access. Local groups are described in /etc/group, while the Name Service Switch can resolve users and groups from local files or configured services.
This distinction matters during troubleshooting. A username is a label resolved by user-space libraries. Ownership stored on a filesystem is numeric. If a directory service becomes unavailable, a file still has the same numeric owner, even when tools cannot display the corresponding name. Reusing a user ID can therefore give a new account access to files owned by the old identity.
Process credentials and group membership
A process has real and effective user and group IDs. The effective IDs usually drive permission checks. A process also has a supplementary group list. Login and session setup establish these credentials, and child processes inherit them. Changing a user's group database entry does not rewrite credentials already held by running sessions; a new login or an appropriate session refresh is normally required.
Continue the course
This section is part of the paid course.
See pricing to subscribe, or log in if you already have access.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://cdn.kernel.org/doc/html/latest/security/credentials.html
Supports
- Processes carry real, effective, saved, and filesystem user and group IDs plus supplementary groups
- Linux objects carry UIDs and GIDs while tasks carry a subjective credential context
- Capabilities provide distinct units of privilege and security modules can add controls
- File markings can include UID, GID, mode, ACL, security label, set-ID bits, and file capabilities
- https://www.gnu.org/software/coreutils/manual/coreutils.html
Supports
- Files have owner, group, and mode attributes
- chmod, chown, chgrp, id, and stat inspect or change relevant attributes
- Symbolic and numeric mode notation used in the course
- https://www.gnu.org/software/coreutils/manual/html_node/Mode-Structure.html
Supports
- Owner, group, and other are the three ordinary permission classes
- Read, write, and execute have file and directory-specific meanings
- Mode bits include set-user-ID, set-group-ID, and sticky components
- https://www.gnu.org/software/coreutils/manual/html_node/Setting-Permissions.html
Supports
- Symbolic modes use a user class, an add-remove-set operation, and permission letters
- Equals replaces, plus adds, and minus removes permissions in a selected class
- https://man7.org/linux/man-pages/man5/passwd.5.html
Supports
- Local account entries map names to UID, primary GID, home directory, and login shell
- Shadow-password systems place an x in passwd and hashes in a restricted shadow file
- Root has UID zero and supplementary groups are defined separately
- https://man7.org/linux/man-pages/man5/group.5.html
Supports
- Local group entries contain a group name, numeric GID, and member list
- https://man7.org/linux/man-pages/man8/useradd.8.html
Supports
- useradd creates accounts from command options and system defaults
- Primary and supplementary group options have distinct roles
- Reusing a UID connects multiple login names to the same ownership and permission identity
- https://man7.org/linux/man-pages/man1/id.1.html
Supports
- id prints real and effective user and group IDs and supplementary groups
- https://man7.org/linux/man-pages/man1/getent.1.html
Supports
- getent queries databases supported by the Name Service Switch
- passwd and group queries resolve through configured sources
- https://man7.org/linux/man-pages/man1/namei.1.html
Supports
- namei follows a pathname and long-list mode shows the mode and owners of each component
- https://man7.org/linux/man-pages/man8/mount.8.html
Supports
- Read-only mounts restrict writes
- The nosuid option suppresses interpretation of set-user-ID and set-group-ID bits
- https://www.gnu.org/software/libc/manual/html_node/Name-Service-Switch.html
Supports
- Name Service Switch configuration selects databases for user and group lookups
- Identity resolution can use sources beyond local files
- https://man7.org/linux/man-pages/man2/chmod.2.html
Supports
- chmod changes mode bits when the effective UID owns the file or the process has required privilege
- Directory execute means search and special mode bits have file or directory effects
- Linux may clear set-ID bits after an unprivileged write
- fchmodat appeared in Linux 2.6.16
- https://man7.org/linux/man-pages/man2/umask.2.html
Supports
- Umask removes bits from the mode requested during object creation
- A default ACL can determine inherited permissions during creation
- https://man7.org/linux/man-pages/man5/acl.5.html
Supports
- ACLs add named user and group entries to the ordinary owner-group-other model
- The ACL mask limits named users, named groups, and the owning group entry
- Default directory ACLs participate in permission inheritance
- Access checks select the owner, named-user, group, or other path without class fallthrough
- https://man7.org/linux/man-pages/man7/capabilities.7.html
Supports
- Linux 2.2 divided superuser privilege into capabilities
- Linux 2.6.24 completed file-capability support
- Linux 2.6.25 made the bounding set per-thread
- Linux 4.3 added ambient capabilities and Linux 4.14 added namespaced file capabilities
- Linux 5.12 added CAP_SETFCAP to the conditions for mapping user ID zero in a user namespace
- https://man7.org/linux/man-pages/man7/user_namespaces.7.html
Supports
- User namespaces isolate user and group ID number spaces and capability scope
- Linux 3.8 allowed unprivileged processes to create user namespaces
- UID and GID mapping files relate namespace identities to identities outside the namespace
- https://www.kernel.org/pub/linux/libs/security/linux-privs/old/doc/linux-privs.html/linux-privs.html
Supports
- The April 1997 Linux-Privs draft described capabilities, ACLs, and process credentials
- https://www.kernel.org/pub/linux/kernel/v2.2/
Supports
- Linux 2.2.0 was published in January 1999
- https://www.kernel.org/pub/linux/kernel/v2.6/
Supports
- Release archive dates for Linux 2.6.16, 2.6.24, and 2.6.25
- https://www.kernel.org/pub/linux/kernel/v3.x/
Supports
- Linux 3.8 release archive date in February 2013
- https://www.kernel.org/pub/linux/kernel/v4.x/
Supports
- Linux 4.3 and 4.14 release archive dates in 2015 and 2017
- https://www.kernel.org/pub/linux/kernel/v5.x/
Supports
- Linux 5.12 release archive date in April 2021
- https://github.com/sindresorhus/awesome
Supports
- The master Awesome index includes an IAM list and routes Linux administration discovery to curated lists
- https://github.com/awesome-foss/awesome-sysadmin
Supports
- The curated sysadmin list includes FreeIPA, OpenLDAP, LLDAP, and LDAP Account Manager in identity-management sections
- https://www.freeipa.org/page/Documentation
Supports
- FreeIPA documents centralized Linux identity, authentication, users, groups, and host access policy
- https://www.openldap.org/doc/admin26/
Supports
- The OpenLDAP guide covers building, configuring, and operating directory services
- LDAP directories can centrally manage user authentication and user or system groups
- https://www.ldap-account-manager.org/static/doc/manual/index.html
Supports
- LDAP Account Manager documents Unix users, Unix groups, shadow attributes, and SSH public keys
- https://github.com/lldap/lldap
Supports
- LLDAP provides an LDAP server and web interface aimed at compact identity-management deployments
