USD ($)
$
United States Dollar
Euro Member Countries
India Rupee

Understanding File Permissions Model

Lesson 13/49 | Study Time: 15 Min

Linux file permissions are a fundamental element of the operating system’s security model. They regulate who can access a file or directory and what actions they can perform, protecting data integrity and privacy.

Every file and directory in Linux has associated permissions that define three types of access—read, write, and execute—for three categories of users: the file owner, the user's group, and others. Understanding this model is essential for managing security, collaboration, and system administration in Linux environments.

The Three User Categories

Linux controls file access by dividing users into distinct permission groups. Below are the three user categories that determine how files and directories can be accessed.


1. Owner (User): The individual who owns the file or directory. Usually, the creator is the owner. They typically have the most permissions.

2. Group: A set of users who share certain permissions for the file or directory. Groups facilitate collaborative workspaces.

3. Others (World): All other users who are not the owner or part of the group. Their permissions are usually the most restricted.

The Three Basic Permissions

Every file and directory in Linux is protected by a set of permission rules. Following are the three basic permissions used to manage access.


1. Read (r): Permission to view or read the contents of the file or list the contents of a directory.

2. Write (w): Permission to modify or delete the file or add/remove files in a directory.

3. Execute (x): Permission to run a file as a program or script, or to enter (cd into) a directory.

Permission Representation

Permissions are displayed in long listing format using ls -l command and look like this:

text
-rwxr-xr--


1. The first character indicates the type (- for file, d for directory).

2. The next three characters (rwx) are permissions for the owner.

3. The next three (r-x) are for the group.

4. The last three (r--) are for others.


In this example, the owner of the file has full permissions, allowing them to read, write, and execute it. Members of the group are permitted to read and execute the file but cannot modify it. All other users have the most restricted access and are allowed to read the file only.

Numeric (Octal) Representation

Permissions can also be represented numerically by summing values:


  • Read = 4
  • Write = 2
  • Execute = 1


For example:


7 (4+2+1) means read, write, execute.

5 (4+0+1) means read and execute.

4 means read only.


A permission like 755 translates to:


  • Owner: 7 (rwx)
  • Group: 5 (r-x)
  • Others: 5 (r-x)

Changing Permissions: chmod Command

chmod modifies file or directory permissions. Using symbolic mode, you can add, remove, or set permissions:


1. chmod u+x file: Adds execute permission to the owner.

2. chmod g-w file: Removes write permission from group.

3. chmod o=r file: Sets others permission to read only.


Using numeric mode, you can assign all permissions at once: chmod 755 file


Special Permissions

1. Setuid (s): Executes a file with the permissions of the file owner.

2. Setgid (s): Executes a file with the permissions of the file's group; for directories, new files inherit the group.

3. Sticky bit (t): Restricts deletion inside a directory to the file’s owner or root, commonly used for /tmp.

Viewing Ownership and Permissions

The command ls -l shows permission strings, ownership, and group affiliations:

text
-rw-r--r-- 1 user group 4096 Oct 10 12:00 file.txt


Here, user is the owner and group is the owner’s group of the file file.txt.

Samuel Wilson

Samuel Wilson

Product Designer
Profile

Class Sessions

1- What is Linux and Operating System Concepts 2- Linux History and Evolution 3- Linux Distributions and Their Purposes 4- Open Source Software and Licensing 5- Graphical User Interface (GUI) and Desktop Environments 6- Terminal Access and Command-Line Fundamentals 7- Getting Help and Command Documentation 8- File System Hierarchy and Directory Structure 9- Navigating Directories and Listing Contents 10- Creating, Copying, and Moving Files and Directories 11- Deleting Files and Directories 12- Symbolic and Hard Links 13- Understanding File Permissions Model 14- Modifying Permissions and Ownership 15- User and Group Management 16- Sudo and Privilege Escalation 17- Text Searching and Pattern Matching 18- Text Processing and Stream Editing 19- Compressing and Archiving Files 20- Text Editing and File Creation 21- Package Management Systems Overview 22- Installing and Updating Software with APT 23- Installing and Updating Software with YUM/DNF 24- Managing Software from Non-Repository Sources 25- Understanding Processes and Process Management 26- Viewing Running Processes 27- Process Control and Termination 28- Task Scheduling with Cron 29- Networking Concepts and IP Addressing 30- Viewing and Configuring Network Interfaces 31- Basic Network Troubleshooting 32- Shell Script Basics 33- Variables and Data Types 34- Conditional Logic in Scripts 35- Loops and Iteration 36- Functions and Code Reuse 37- Input/Output and User Interaction 38- System Authentication and Access Control 39- File System Security 40- Software Updates and Patching 41- Basic Firewall Concepts 42- System Information and Monitoring 43- Service and Daemon Management 44- System Boot Process and Runlevels 45- System Backup and Disaster Recovery 46- Comprehensive File System Management 47- System Automation Workflows 48- Multi-Concept Troubleshooting Scenarios 49- Continued Learning Pathways

Sales Campaign

Sales Campaign

We have a sales campaign on our promoted courses and products. You can purchase 1 products at a discounted price up to 15% discount.