Linux File Permissions Explained for Beginners | Understanding rwx, chmod, 777, and Octal Binary Modes with Practical Examples
Linux file permissions are an essential part of system administration, cybersecurity, and development environments. This guide explains how Linux permissions work using rwx (read, write, execute), binary-to-octal conversions, symbolic vs numeric modes, and the chmod command. With real-world examples, visual references, and 30 FAQs, this blog will help beginners and professionals understand and manage access rights effectively on files and directories in Linux-based systems. You'll learn how to decode permissions like 755 or rwxr-xr-x, change them safely, and understand their importance for system security.

Table of Contents
- What Are Linux File Permissions?
- How Permissions Are Displayed in Linux
- Permission Values in Binary, Octal, and Symbolic Mode
- Visual Example of File Permission Mapping
- Changing File Permissions Using chmod
- Understanding Default Permissions (Umask)
- Why File Permissions Are Important
- Real-Time Use Case Example
- Summary Table of chmod Values
- Conclusion
- Frequently Asked Questions (FAQs)
Linux is known for its robust permission system. Whether you are a beginner, a student, a developer, or a system administrator, understanding file permissions is essential for protecting sensitive data and managing access rights properly. In this blog, we'll explore Linux file permissions in a simple and detailed way, breaking them down into binary, octal, and symbolic formats, with examples and tables for easy understanding.
What Are Linux File Permissions?
Linux file permissions control who can read, write, or execute a file or directory. Every file in Linux is associated with permission settings that determine what actions can be performed on it and by whom.
Permissions in Linux are assigned to three types of users:
-
User (u) – the file owner
-
Group (g) – a group that the file belongs to
-
Others (o) – everyone else
For each user type, there are three kinds of permissions:
-
Read (r) – Permission to view the contents of a file or directory
-
Write (w) – Permission to modify or delete the contents
-
Execute (x) – Permission to run a file as a program or enter a directory
How Permissions Are Displayed in Linux
When you run the command ls -l
in a Linux terminal, the permissions are displayed in a 10-character string like this:
-rwxr-xr--
Here’s what this means:
-
The first character indicates the file type (
-
for a regular file,d
for a directory) -
The next 3 characters (
rwx
) show the owner’s permissions -
The next 3 (
r-x
) show the group’s permissions -
The last 3 (
r--
) show the others' permissions
Permission Values in Binary, Octal, and Symbolic Mode
Linux permissions are often expressed in octal numbers when using commands like chmod
. These numbers are derived from binary values based on the type of access:
Binary | Octal | Permission Type | Symbolic Mode |
---|---|---|---|
000 | 0 | No Permission | --- |
001 | 1 | Execute only | --x |
010 | 2 | Write only | -w- |
011 | 3 | Write and Execute | -wx |
100 | 4 | Read only | r-- |
101 | 5 | Read and Execute | r-x |
110 | 6 | Read and Write | rw- |
111 | 7 | Read, Write, and Execute | rwx |
So, if a file has permissions like rwxr-xr--
, the octal representation would be:
-
Owner (rwx) = 7
-
Group (r-x) = 5
-
Others (r--) = 4
So, the full permission is 754.
Visual Example of File Permission Mapping
Let’s break down this string using a visual example:
-rwxrwxr-x
-
File type:
-
(regular file) -
Owner permissions:
rwx
= 7 -
Group permissions:
rwx
= 7 -
Others permissions:
r-x
= 5
Final octal representation = 775
Changing File Permissions Using chmod
To change file permissions in Linux, use the chmod
command.
Example:
chmod 755 myfile.sh
This command sets the permission to:
-
User: Read, Write, Execute (7)
-
Group: Read, Execute (5)
-
Others: Read, Execute (5)
Symbolically:
-rwxr-xr-x
You can also change permissions using the symbolic method:
chmod u+x file.sh # Adds execute permission to the user
chmod g-w file.sh # Removes write permission from the group
Understanding Default Permissions (Umask)
When a file is created, it doesn’t automatically get full 777
permissions. The default permissions are restricted by a value called umask.
-
Default permission for files:
666
(read & write for all) -
Default permission for directories:
777
(read, write & execute for all)
Umask subtracts from these values. If umask is 022
, then:
-
Files get:
644
(rw-r--r--) -
Directories get:
755
(rwxr-xr-x)
Why File Permissions Are Important
Proper permission settings protect your system from:
-
Unauthorized access
-
Accidental deletion or modification
-
Exploits or malware execution
In cybersecurity, misconfigured file permissions are a common vulnerability attackers exploit. For example, giving everyone write access (777
) can let hackers modify or inject malicious code into your files.
Real-Time Use Case Example
Let’s say you’re deploying a web application.
-
Your HTML/CSS/JS files should be readable by the web server (
chmod 644
) -
Your directories should be accessible (
chmod 755
) -
Your sensitive config files (like
.env
) should not be world-readable or writable (chmod 600
)
Summary Table of chmod Values
Octal | Symbolic | Who Gets What |
---|---|---|
777 | rwxrwxrwx | Everyone can do everything |
755 | rwxr-xr-x | Owner can modify; others can read/execute |
700 | rwx------ | Only owner can access |
644 | rw-r--r-- | Owner can write; others read-only |
600 | rw------- | Owner read/write; no access to others |
Conclusion
Understanding Linux file permissions is key to maintaining security, privacy, and operational control over files and directories. Whether you are managing a multi-user system or securing a server, these permissions give you the power to control who can do what on your system.
Make it a habit to check and properly set file permissions. It could save you from accidental damage, security risks, and system vulnerabilities in the future.
Got it! Here's the corrected version of 30 FAQs where no
tags are used at all, just bolded questions and clean answers — exactly as you requested.
Frequently Asked Questions (FAQs)
What are Linux file permissions?
Linux file permissions define who can read, write, or execute a file or directory in a system.
Why are file permissions important in Linux?
They help secure files and folders by restricting unauthorized access.
What do read, write, and execute mean in file permissions?
Read allows viewing, write allows modifying, and execute enables running files or accessing directories.
What is symbolic notation in Linux permissions?
Symbolic notation uses characters like r (read), w (write), and x (execute) to show permissions.
What is numeric or octal notation?
Octal notation uses numbers like 777 or 644 to represent permissions in binary form.
How do I interpret -rwxr-xr--?
It means the owner has full permissions, the group can read and execute, and others can only read.
What is the chmod command?
The chmod command changes file and directory permissions in Linux.
What does chmod 777 mean?
It gives read, write, and execute permissions to everyone.
Is chmod 777 safe to use?
No, it's dangerous because it allows any user to modify or run the file.
What does chmod 644 do?
It gives read and write to the owner, and read-only to the group and others.
What are user, group, and others in permissions?
They represent the file’s owner, a specific group of users, and all other users.
How can I check file permissions in Linux?
Use the ls -l
command to list file permissions in detail.
How do I change file ownership?
Use the chown
command to change the owner and group of a file or directory.
What is the default permission for new files?
Usually 644 for files and 755 for directories, unless modified by umask.
What is umask?
Umask is a default system value that sets base permissions for new files.
Can directories have execute permission?
Yes, execute on a directory means you can access and enter it.
What is chmod +x used for?
It adds execute permission to a file, making it runnable.
How can I remove all permissions from a file?
Use chmod 000
to remove read, write, and execute for all.
What are special permissions in Linux?
They include SUID, SGID, and the Sticky Bit for advanced access control.
What is SUID?
SUID allows users to run a file with the file owner's permissions.
What is SGID?
SGID applies group permissions to files or directories and ensures group consistency.
What is the Sticky Bit?
Sticky Bit prevents users from deleting others’ files in a shared directory.
What happens if you set 000 on a file?
Nobody can read, write, or execute the file — it’s completely restricted.
Can I give execute permission without read or write?
Yes, with chmod 111
, you can allow execute only.
How do I recursively change permissions?
Use the chmod -R
flag to apply permissions to directories and their contents.
What’s the difference between 755 and 777?
755 is more secure (owner has full access, others can only read and execute), while 777 allows everything for everyone.
How do I make a shell script executable?
Use chmod +x script.sh
to allow execution.
Can permissions be inherited in Linux?
By default, no. But you can control behavior using umask and SGID on directories.
How do I change directory permissions?
Use chmod
followed by the permission code and directory name.
Are file permissions the same across all Linux distros?
Yes, the permission model is the same in most Unix-like systems including all Linux distributions.