Use it when files show numbers instead of names, or ownership breaks between systems (NFS, restored backups, containers).
UID / GID
The UID (user ID) and GID (group ID) are the numbers the kernel actually uses; names are just lookups. UID 0 is root; system accounts typically use 1–999 and regular users 1000 and up.
1. ls -ln <path> — numeric owner.
2. getent passwd <uid> — which name has it here?
3. Mismatch between hosts → align UIDs or use ID mapping (NFSv4 idmapd).
4. Orphaned files: find / -xdev -nouser -o -nogroup.
5. chown to the correct user.
process runs with UID/GID → file has owner UID/GID → kernel compares numbers → names resolved only for display
For Users & Groups → UID / GID, continue with the first unproven Topic check: Record numeric UID/GID instead of only names. If that boundary is healthy, advance to the adjacent check: Inspect process real/effective credentials and supplementary groups. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.
Continue only after interpreting the current observation.Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
id <user>Primary Commands
Configuration and operational commands for this Topic.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational evidence path Verify boundary
name → NSS/identity resolver → numeric UID/GID → namespace mapping → process credentials → inode numeric owner/group → DAC/ACL evaluation → result
Healthy evidence: numeric IDs resolve and map as intended across the relevant namespace, process and filesystem object, producing the expected access decision.
Step 2 Verification and output interpretation Verify boundary
Existing fast checks for this Topic. - Record numeric UID/GID instead of only names.
- Inspect process real/effective credentials and supplementary groups.
- Compare numeric inode ownership across the same namespace and host context.
- For moved/restored/containerized data, verify ID mappings before changing ownership.
Verification chain. name → NSS/identity resolver → numeric UID/GID → namespace mapping → process credentials → inode numeric owner/group → DAC/ACL evaluation → result
Step 3 Commands Verify boundary
id -u alice ; id -g alice
getent passwd 1001
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: ownership shows unexpected numbers after restore/migration, names hide a numeric mismatch, or namespace ID mapping is ignored.
Step 5 Common mistakes Narrow the fault
- UID mismatch between hosts sharing NFS.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
Permissions follow numbers: the same name with a different UID on another host (NFS, rsync) gives the wrong owner. Keep UIDs consistent across systems or use a directory service. Files owned by a deleted user show a bare number.
ls -ln <path>— numeric owner and groupid <user>— UID, primary group and groupsgetent passwd <user>— account entry (local or directory)getent group <group>— group memberssudo -l -U <user>— what the user may run with sudo
ReferenceWhat it is1 section · depth on demand
Core model
Trace a name through the identity resolver to UID/GID, then inspect real, effective, saved and filesystem credentials where relevant plus supplementary groups. When data crosses hosts, containers, user namespaces or restored filesystems, identical names can map to different IDs and identical IDs can represent different intended principals.
ReferenceImportant terms & boundaries5 sections · depth on demand
What this shows and what it does not
Numeric identity establishes credential values, not the intended human/service meaning, namespace mapping correctness or final authorization outcome.
In depth
UIDs, GIDs and process credentials
The kernel doesn't know user names. It works only with numbers, and names are mapped to UIDs and GIDs by the user database. The credentials(7) manual page describes the IDs every process carries:
- Real UID and GID: who owns the process.
- Effective UID and GID: used for most permission checks.
- Saved set-user-ID: a copy of the effective ID from when a set-user-ID program started, so it can switch privileges back and forth.
- Filesystem UID: used for file access checks on Linux, normally equal to the effective UID.
- Supplementary groups.
A child created by fork inherits copies of all of these. execve keeps the real IDs, while the effective and saved IDs may change for set-user-ID programs.
Common UID ranges
| Range | Use |
|---|---|
| 0 | root |
| 1–999 | System and service accounts (SYS_UID_MIN–SYS_UID_MAX) |
| 1000–60000 | Regular users (UID_MIN–UID_MAX) |
| 65534 | nobody / nogroup |
| Large values (e.g. 100000+) | Directory users (SSSD, AD), container user namespaces |
Why numbers matter
| Situation | Effect |
|---|---|
| Restoring a backup on another host | Files keep their UIDs, which may belong to different names there |
| NFS without ID mapping | The server checks numeric UIDs from the client |
| Containers with user namespaces | UID 0 in the container maps to an unprivileged UID on the host |
| A user deleted, files left behind | ls -l shows a bare number instead of a name |
host$ id
uid=1003(alice) gid=1003(alice) groups=1003(alice),4(adm),1010(ssh-users)
host$ ps -o pid,ruser,euser,suser,fuser,comm -p $$
PID RUSER EUSER SUSER FUSER COMMAND
4410 alice alice alice alice bash
host$ grep -E "^(Uid|Gid|Groups)" /proc/self/status
Uid: 1003 1003 1003 1003
Gid: 1003 1003 1003 1003
Groups: 4 1003 1010
host$ sudo find /srv -nouser -o -nogroup | head
host$ ls -ln /srv/data/report.csv
-rw-r----- 1 1187 1187 4096 Nov 27 10:12 /srv/data/report.csv
Reading /proc/self/status
The four values on the Uid: line are the real, effective, saved and filesystem UIDs, in that order. For a set-user-ID program, the effective and saved values differ from the real UID. That's the mechanism behind passwd and sudo.
Documented example, not captured output.
How it works at runtime
UID / GID is part of Users & Groups → UID / GID. UID and GID are the numeric Linux identity values consumed by the kernel for users and groups; names are resolved presentation and administration labels layered on top of those numeric credentials.
Topic-specific state model. UID and GID are the numeric Linux identity values consumed by the kernel for users and groups; names are resolved presentation and administration labels layered on top of those numeric credentials.
Interpretation rule. - Name equality ≠ numeric identity equality.
- UID 0 semantics can be modified by namespaces/capabilities and does not mean unrestricted access everywhere.
- File owner numeric ID persists even if the current host cannot resolve a matching name.
- Container/user-namespace IDs may be mapped relative to host IDs.
Quick reference
UIDs and GIDs are the numbers the kernel actually checks; names are just lookups via NSS.
| Range | Use |
|---|---|
| 0 | root |
| 1–999 | System/service accounts (SYS_UID_MAX in /etc/login.defs) |
| 1000+ | Regular users |
| 65534 | nobody/nogroup |
id; id -u; getent passwd 1000
find / -xdev -uid 1003 -ls # files of a deleted/renumbered user
ls -ln # numeric owners
Keep UIDs consistent across servers sharing NFS or backups, otherwise files appear owned by the wrong user. Container user namespaces map container UID 0 to an unprivileged host UID range (/etc/subuid).
Limits and how it fails
Primary failure point. Numeric identity establishes credential values, not the intended human/service meaning, namespace mapping correctness or final authorization outcome.
ReferenceConfiguration & state1 section · depth on demand
Configuration, persistence and lifecycle
Distribution/platform context. UID/GID owns numeric identity semantics. User namespaces, capabilities, external identity and permission policy remain separate topics/branches.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Users & Groups → UID / GID. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.kernel.org/doc/man-pages/ · confidence 94%What changed and what may be affected
Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
UID / GID operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for UID / GID.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | UID and GID are the numeric Linux identity values consumed by the kernel for users and groups; names are resolved presentation and administration labels layered on top of those numeric credentials. | Establish exactly what this Topic owns before crossing into another subsystem. |
| Fast verification | Pin the exact process/session → resolve user/group names to numeric UID/GID through the effective identity stack → capture effective UID/GID + supplementary groups → resolve every required path component and target inode → inspect numeric owner/group + mode + ACL/mask + special bits → capture sudo/privilege transition if present → account for non-DAC controls → repeat the original workload operation. | Use the shortest evidence path first; a fast check is a boundary test, not blanket proof. |
| Verification chain | name → NSS/identity resolver → numeric UID/GID → namespace mapping → process credentials → inode numeric owner/group → DAC/ACL evaluation → result | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | Numeric identity establishes credential values, not the intended human/service meaning, namespace mapping correctness or final authorization outcome. | Stop broad troubleshooting at the first boundary that is not supported by evidence. |
| Positive evidence | Correlated Linux identity and authorization evidence can establish this proof path: name → NSS/identity resolver → numeric UID/GID → namespace mapping → process credentials → inode numeric owner/group → DAC/ACL evaluation → result | Use this observation only for the specific claim it actually supports. |
| Evidence limit | It does not independently prove behavior outside the captured identity source, process credential, filesystem object, DAC/ACL, privilege or workload scope. Numeric identity establishes credential values, not the intended human/service meaning, namespace mapping correctness or final authorization outcome. | Do not promote a local success signal into end-to-end or adjacent-dependency proof. |
| Next troubleshooting check | Continue from the first unproven boundary: keep the same process/session, resolve numeric identity and groups, inspect each path component plus target ownership/mode/ACL/special bits, capture any privilege transition/non-DAC denial, then repeat the original operation before broadening permissions. | Continue to the next unresolved boundary while preserving the original test condition. |
UID / GID · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | UID / GID |
|---|---|
| Topic path | Users & Groups → UID / GID |
| Runtime state | UID and GID are the numeric Linux identity values consumed by the kernel for users and groups; names are resolved presentation and administration labels layered on top of those numeric credentials. |
| Fast checks | - Record numeric UID/GID instead of only names. - Inspect process real/effective credentials and supplementary groups. - Compare numeric inode ownership across the same namespace and host context. - For moved/restored/containerized data, verify ID mappings before changing ownership. |
| Verification chain | name → NSS/identity resolver → numeric UID/GID → namespace mapping → process credentials → inode numeric owner/group → DAC/ACL evaluation → result Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return path or regression → explicit Evidence boundary. |
| Failure boundary | Numeric identity establishes credential values, not the intended human/service meaning, namespace mapping correctness or final authorization outcome. Boundary chain: process/context → userspace configuration → kernel subsystem/resource → device/network/filesystem dependency → effective state → original workload. |
| Persistence rule | Prove which configuration source owns the state, then prove that the running consumer loaded or generated the intended state. |