Linux File Ownership and Permission Checks
Learn how to read Linux file ownership and permission listings, inspect your own user and group identities, and determine which permission class applies to a process.
Inspecting Files and Selecting a
Inspect the identities and file
Use id to see your current user and group identities, including supplementary groups. Use ls -l to see a file’s type, permissions, owner, and group. These commands show the information needed to determine which permission set applies; id reports the current process context, while ls -l reports the file’s ownership and permission bits.
| Class | Who it applies to | Permissions |
|---|---|---|
| Owner | File’s owning user: maya | rw- |
| Group | Processes belonging to the file’s group: analysts | r-- |
| Other | Processes that are neither the owner nor in the file’s group | --- |
Select the applicable set
In ls -l output, the first character indicates file type; read the next nine characters in three groups: owner, group, and other. The source listing is -rw-r----- 1 maya analysts 820 Nov 21 10:30 report.txt. Its permission sets are rw-, r--, and ---, respectively.
The access check chooses one set in order: first, if the process’s user is maya, use the owner set (rw-). Otherwise, if the process belongs to analysts, use the group set (r--). Otherwise, use the other set (---). For example, hypothetically, a process that is not running as maya but belongs to analysts is checked against r--; it does not combine the group and other sets. Check the process’s identities with id and compare them with the owner and group shown by ls -l.
: The user and group identities of a process, including any supplementary groups.