Choose User, Group and Others Rules

Choose User, Group and Others Rules

The mode string contains three ordinary permission triplets, but a user does not simply add them all together. Linux checks the person's relationship to the file to choose the applicable ordinary class. This matters when one triplet looks more generous than another.

For the basic model, ask: is this the owning user? If not, does the relevant group relationship apply? Otherwise, consider others. We will use that model first and keep extended ACLs and privileged access separate, rather than pretending every real access decision fits one short string.

What you’ll learn

  • Determine which ordinary access class applies to a user.
  • Explain why owner, group and others permissions are not simply added together.

Ordinary class selection follows the user’s relationship

  1. Owner match

    If the user owns the file, the owner class applies.

    owner bits
  2. Group match

    Otherwise, applicable group membership determines the group class.

    group bits
  3. Otherwise

    Users outside those classes receive others permissions; ACLs and privilege add separate rules.

    others bits
Identify the applicable ordinary class before reading its bits.

Decide which class applies to the marks file

Prepare the example

Use an owned practice file in a fresh directory. The block creates it and sets ordinary mode 640. Read its owner and group from ls -l, because the class names only make sense in relation to those identities.

Bash · Linux terminal

touch marks.txt
chmod 640 marks.txt
ls -l marks.txt

Expected behavior; machine-dependent details

Owner rw-, group r--, others ---.

For 640, the owning user has read/write bits, the applicable group class has read, and others have no ordinary bits. If you own the file, the owner triplet applies; you do not automatically borrow permissions from others just because their triplet might allow something different.

Now consider a member of the owning group who is not the owner. Their basic file access follows the group class. Someone outside those relationships follows others. Directory traversal, ACLs, mount state and security policy can still constrain an actual operation, and privileged mechanisms are a separate layer. Use the simple class model to explain its part, not as a promise that any permitted-looking bit guarantees success.

Match identities to the applicable access class

Traditional Linux permissions answer two questions: which class of user is accessing the object, and which actions that class is allowed to perform.

What are Linux File Permissions?

In Linux, every file and directory has a set of permissions associated with it. These permissions determine who can do what with a file.

There are three types of users:

  • User – the owner of the file
  • Group – other users who belong to the same group
  • Others – everyone else on the system

Viewing Permissions

Let’s list files with permissions using ls -l:

ls -l
-rwxr-xr--  1 alice devs  1024 Jul 1 10:00 script.sh

This line can be read like this:

  • - means it's a regular file (not a directory)
  • rwx → user (alice) has read, write, and execute permissions
  • r-x → group (devs) has read and execute permissions
  • r-- → others have read-only permission

Breaking Down the Permission String

The permission part rwxr-xr-- is split into three blocks:

  • First 3 (rwx): for the user
  • Next 3 (r-x): for the group
  • Last 3 (r--): for others

Each character means:

  • r: read – can view contents
  • w: write – can edit or delete
  • x: execute – can run the file (if it’s a script or program)

Example with a Directory

ls -ld myfolder
drwxr-x---  2 bob staff 4096 Jul 1 12:00 myfolder

This tells us:

  • d: it's a directory
  • rwx: bob (the owner) can list, add, or remove files in the folder
  • r-x: group members can list and access files (but not create or delete)
  • ---: others have no access at all

Commands that change permissions and ownership

  • To change file permissions: chmod
  • To change file owner: chown
  • To change file group: chgrp

Separate owner, group and other permission sets

Permissions help protect your files in a multi-user system. Always set them based on who really needs access.

Try it, then check the worked answer

Your task: Can an owner with no ordinary read bit automatically borrow the others read bit?

Use an owned practice file in a fresh directory. The block creates it and sets ordinary mode 640. Read its owner and group from ls -l, because the class names only make sense in relation to those identities.

Bash · complete example for this question

touch marks.txt
chmod 640 marks.txt
ls -l marks.txt

Expected behavior; machine-dependent details

Owner rw-, group r--, others ---.

Worked answer

No; ordinary class selection does not work that way.

An owner with no ordinary read bit cannot simply switch to the others class to gain its read bit. The class selection is based on identity, not on choosing whichever triplet is most convenient. Privileged bypass requires a separate explanation.

Check your decision

Can an owner with no ordinary read bit automatically borrow the others read bit?
Choose one answer. You can try again.

Answer and explanation

No; ordinary class selection does not work that way.

An owner with no ordinary read bit cannot simply switch to the others class to gain its read bit. The class selection is based on identity, not on choosing whichever triplet is most convenient. Privileged bypass requires a separate explanation.

Do not merge every permission triplet

Identify the applicable ordinary class before reading its bits. Do not merge owner, group and others into one generous permission set. When real behavior differs from the basic prediction, investigate the additional access rules rather than discard the identity relationship you just established.

Reaching the recap and completing the quizzes are separate milestones.

    Next lesson: Distinguish SUID, SGID and Sticky Bits →