Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

UID / GID

Direct answer

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.

When to use this

Use it when files show numbers instead of names, or ownership breaks between systems (NFS, restored backups, containers).

First 30 seconds

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.

Operational verification

process runs with UID/GID → file has owner UID/GID → kernel compares numbers → names resolved only for display

Evidence · next step

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
Platform / version applicability
linux
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformlinux · Linux · distribution/version specific
Key commandid <user>
Scope / prerequisiteUse it when files show numbers instead of names, or ownership breaks between systems (NFS, restored backups, containers…
Reference · 1
What next?3 suggested next steps
Catalog command links1
Evidence1
On this pageJump to a specific section
Linux command reference

Primary Commands

Configuration and operational commands for this Topic.

Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

5 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

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 references

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.

observation · 1
Key points

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.

Key checks
  • ls -ln <path> — numeric owner and group
  • id <user> — UID, primary group and groups
  • getent passwd <user> — account entry (local or directory)
  • getent group <group> — group members
  • sudo -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

RangeUse
0root
1–999System and service accounts (SYS_UID_MIN–SYS_UID_MAX)
1000–60000Regular users (UID_MIN–UID_MAX)
65534nobody / nogroup
Large values (e.g. 100000+)Directory users (SSSD, AD), container user namespaces

Why numbers matter

SituationEffect
Restoring a backup on another hostFiles keep their UIDs, which may belong to different names there
NFS without ID mappingThe server checks numeric UIDs from the client
Containers with user namespacesUID 0 in the container maps to an unprivileged UID on the host
A user deleted, files left behindls -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.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

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.

RangeUse
0root
1–999System/service accounts (SYS_UID_MAX in /etc/login.defs)
1000+Regular users
65534nobody/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).

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

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
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor doclinux current

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%
Technical changelog & impact

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.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
Terminology layer

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.

Aliases that resolve here
uid gid linuxlinux numeric user idlinux numeric group iduser group ids
Embedded reference data

Quick lookup tables

UID / GID operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for UID / GID.

Lookup boundaryTopic-specific referenceOperational use
Scope / effective stateUID 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 verificationPin 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 chainname → NSS/identity resolver → numeric UID/GID → namespace mapping → process credentials → inode numeric owner/group → DAC/ACL evaluation → resultTrace requested/configured state through effective state to the observed workload result.
Failure boundaryNumeric 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 evidenceCorrelated 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 → resultUse this observation only for the specific claim it actually supports.
Evidence limitIt 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 checkContinue 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 boundaryUID / GID
Topic pathUsers & Groups → UID / GID
Runtime stateUID 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 chainname → 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 boundaryNumeric 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 ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.
Confirmation

Confirm action

Continue?