Skip to content

Lesson 05 — Linux File Permissions

Imagine a company where every employee can read confidential HR records, modify financial reports, or delete production application files.

It would quickly become a security disaster.

Linux prevents this by using File Permissions.

Every file and directory in Linux has permissions that determine:

  • Who can read it
  • Who can modify it
  • Who can execute it

File permissions are one of the most important security mechanisms in Linux and form the foundation of access control across cloud platforms, enterprise servers, Kubernetes clusters, and cybersecurity environments.

Understanding Linux permissions is essential for every Linux Administrator, Cloud Engineer, DevOps Engineer, and Cybersecurity Professional.


After completing this lesson, you will be able to:

  • Explain Linux file ownership.
  • Understand read, write, and execute permissions.
  • Interpret symbolic and numeric permissions.
  • Use chmod, chown, and chgrp.
  • Understand special permissions.
  • Apply Linux permission best practices.

Without permissions:

  • Anyone could delete system files.
  • Sensitive data could be stolen.
  • Applications could be modified.
  • Malware could spread easily.

Permissions protect Linux systems by ensuring users can only access what they are authorized to use.


Every file in Linux has an owner.

Example:

report.txt
Owner:
student

The owner usually has the greatest level of control over the file.


Files also belong to a group.

Example:

report.txt
Owner:
student
Group:
developers

Group permissions allow multiple users to collaborate securely.


Linux permissions are divided into three categories.

Category Description
User (u) File owner
Group (g) Members of the assigned group
Others (o) Everyone else

Together these determine who can access a file.


Linux supports three basic permissions.

Permission Symbol Value
Read r 4
Write w 2
Execute x 1

These values are used when setting numeric permissions.


Read permission allows a user to view a file.

Example:

report.txt
Permission:
r--

Users can:

  • Open the file
  • Read its contents
  • Copy the file

Write permission allows modifications.

Example:

rw-

Users can:

  • Edit files
  • Save changes
  • Delete contents

Execute permission allows a file to run as a program or script.

Example:

rwx

Typical executable files include:

  • Bash Scripts
  • Python Programs
  • Shell Utilities

Directories also use execute permission to allow users to enter them.


Display permissions.

Terminal window
ls -l

Example:

-rwxr-xr--
student developers report.sh

Example:

-rwxr-xr--

Breakdown:

-
Regular File
rwx
Owner
r-x
Group
r--
Others

This means:

Owner:

  • Read
  • Write
  • Execute

Group:

  • Read
  • Execute

Others:

  • Read Only

Directories use permissions differently.

Permission Meaning
Read View directory contents
Write Create/Delete files
Execute Enter the directory

Without execute permission, users cannot access the directory even if they can read its contents.


Linux also supports numeric notation.

Value Permission
7 rwx
6 rw-
5 r-x
4 r–
3 -wx
2 -w-
1 –x
0

Numeric Symbolic Meaning
777 rwxrwxrwx Full access for everyone
755 rwxr-xr-x Common for directories
744 rwxr–r– Owner full control
700 rwx—— Private directory
644 rw-r–r– Common for files
600 rw—–– Sensitive files

Understanding these values is essential for Linux administration.


Use chmod.

Example:

Terminal window
chmod 755 script.sh

Or use symbolic notation.

Terminal window
chmod u+x script.sh

Remove write permission.

Terminal window
chmod g-w report.txt

Use chown.

Example:

Terminal window
sudo chown student report.txt

Change owner and group.

Terminal window
sudo chown student:developers report.txt

Use chgrp.

Example:

Terminal window
sudo chgrp developers report.txt

Linux automatically assigns default permissions to new files and directories.

Display the current umask.

Terminal window
umask

Typical output:

0022

The umask removes permissions from the default values.

Example defaults:

Files:

666

Directories:

777

The umask determines the final permissions.


Linux supports three special permissions.


Programs run using the owner’s privileges.

Example:

Terminal window
chmod u+s filename

Files inherit the directory’s group ownership.

Example:

Terminal window
chmod g+s directory

Useful for collaborative projects.


Only the file owner can delete files in the directory.

Common example:

/tmp

Set Sticky Bit:

Terminal window
chmod +t directory

Example 1

Private SSH key:

600

Only the owner can read and write.


Example 2

Shell script:

755

Owner can modify it, everyone can execute it.


Example 3

Website file:

644

Owner can edit.

Others can read.


Linux permissions protect cloud resources.

Examples:

  • SSH keys
  • Application files
  • Configuration files
  • Kubernetes manifests
  • Terraform files

Cloud Engineers frequently use chmod to secure sensitive credentials.


Security teams investigate:

  • World-writable files
  • Incorrect ownership
  • Privilege escalation risks
  • SUID binaries
  • Sensitive configuration files

Misconfigured permissions are a common security weakness.


Display permissions:

Terminal window
ls -l

Display hidden files:

Terminal window
ls -la

Change permissions:

Terminal window
chmod

Change ownership:

Terminal window
chown

Change group:

Terminal window
chgrp

Display current umask:

Terminal window
umask

A DevOps Engineer deploys a web application.

Application Files
Owner
www-data
Permissions
644
Configuration Files
600
Deployment Script
755

Correct permissions help protect the application while allowing it to function properly.


As a Linux administrator:

  • Follow the Principle of Least Privilege.
  • Avoid using 777 permissions.
  • Secure sensitive files with 600.
  • Use groups for shared access.
  • Review file ownership regularly.
  • Protect SSH keys.
  • Audit SUID and SGID files.
  • Monitor permission changes.

Proper permission management significantly improves Linux security.


After completing this lesson, you should understand:

  • Linux file ownership.
  • User, Group, and Others permissions.
  • Read, Write, and Execute permissions.
  • Symbolic and numeric permission notation.
  • chmod, chown, chgrp, and umask.
  • Special permissions (SUID, SGID, Sticky Bit).
  • Linux permission best practices.

Linux File Permissions are one of the most important security mechanisms in the operating system.

By controlling who can read, modify, and execute files, Linux protects users, applications, and critical system resources from unauthorized access.

Throughout your career, you’ll use these concepts to secure cloud servers, deploy applications, protect sensitive data, and troubleshoot permission-related issues in enterprise environments.

Mastering Linux permissions is a foundational skill for Cloud Computing, Cybersecurity, DevOps, and Linux Administration.


➡️ Lesson 06 — Linux Processes

In the next lesson, you’ll learn how Linux manages running processes, understand process states and priorities, monitor system activity, and use commands like ps, top, htop, kill, and nice to manage applications and troubleshoot performance issues.