Skip to main content
Managing file permissions is a core skill for any Linux administrator or user. In this guide, you’ll learn how to view ownership, adjust user and group assignments, interpret permission bits, and modify permissions using both symbolic and octal notation.

Table of Contents

  1. Understanding Ownership
  2. Viewing Owner, Group, and Permissions
  3. Changing Owner and Group
  4. File Types and Permission Bits
  5. Permission Evaluation Order
  6. Modifying Permissions with chmod
  7. Using Octal Notation with chmod
  8. Resources & References

Understanding Ownership

Every file or directory on Linux has:
  • User owner (UID)
  • Group owner (GID)
Only the file’s owner or root can change its permissions or ownership.

Viewing Owner, Group, and Permissions

Run ls -l to display permissions, owner, group, size, and timestamp:
  • -rw-r-----: File type and permission bits
  • aaron   : User owner
  • family   : Group owner

Changing Owner and Group

Change Group: chgrp

Example:
You can only switch to groups you belong to. Use groups to list them:

Change Owner: chown

Only root (or via sudo) can change the user owner:
Example:
You can change both user and group:

File Types and Permission Bits

The first character in ls -l indicates the file type: Permission bits follow in three sets (owner, group, others):
[!note] For directories:
  • r: list contents
  • w: create/delete files
  • x: change into the directory
The image illustrates file and directory permissions in a Unix-like system, showing "rwx" for owner, group, and others, with a key explaining the meaning of each permission bit.

Permission Evaluation Order

Linux checks permissions in this order:
  1. Owner
  2. Group
  3. Others
Consider a file owned by aaron:family with permissions -r--rw----:
  • As aaron: owner bits (r--) apply → no write
  • As jane (in family): owner bits skipped, group bits (rw-) apply → can write
  • Else: “others” bits determine access.

Modifying Permissions with chmod

General syntax:
  • who: u (owner), g (group), o (others), a (all)
  • +: add permissions
  • -: remove permissions
  • =: set exact permissions

Adding Permissions

Grant write to owner:

Removing Permissions

Use - to revoke bits. Common patterns:
  • u-w: remove owner write
  • g-rw: remove group read/write
  • o-rwx: remove all for others
The image shows a terminal interface with instructions on removing permissions for users, groups, and others, using options like "u-", "g-", and "o-". Examples include "u-w", "g-rw", and "o-rwx".
Remove read for others:

Setting Exact Permissions

Overwrite existing bits with =:

Combining Multiple Changes

Separate specs with commas:

Using Octal Notation with chmod

Octal mode is a compact way to set permissions. First, inspect with stat:
[!note] Each octal digit = read (4) + write (2) + execute (1).
For 0640:
  • Owner 6 = rw-
  • Group 4 = r--
  • Others 0 = ---
The image illustrates octal file permissions, showing the conversion between symbolic, binary, and decimal representations. It includes examples of permissions like "rw-r--r--" and "rwxr-xr-x" with their corresponding binary and decimal values.
Set 0640 directly:

Resources & References

Watch Video