Timedora

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.

Permission sets in the listing
ClassWho it applies toPermissions
OwnerFile’s owning user: mayarw-
GroupProcesses belonging to the file’s group: analystsr--
OtherProcesses that are neither the owner nor in the file’s group---
The nine permission characters in `-rw-r-----` are grouped as owner, group, then other. The listing names `maya` as owner and `analysts` as 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.