Skip to content
-
Check latest Techrunbook articles. Click here!
TechRunbook
TechRunbook
  • Home
  • About Us
  • Contact
  • Terms of Use
  • Home
  • About Us
  • Contact
  • Terms of Use
Close

Search

Linux File Permissions
Linux

Linux File Permissions Explained: chmod, chown & rwx

By Bilal Khan
September 17, 2026 10 Min Read
0

Linux File Permissions Explained: chmod, chown, and rwx

Learn how Linux file permissions work, understand rwx permissions, and use chmod, chown, and chgrp safely to control access to files and directories.

Written by Bilal Khan · Updated: 2026-09-17

TechRunbook approach: Before changing permissions, identify the file owner, group, current permissions, and the access that is actually required. Avoid using overly broad permissions such as 777 as a quick fix.


Why Linux File Permissions Matter

Table of Contents

  • Linux File Permissions Explained: chmod, chown, and rwx
    • Why Linux File Permissions Matter
  • 1. Check Linux File Permissions With ls -l
  • 2. Understand rwx Permissions
  • 3. Owner, Group, and Others
  • 4. What Does chmod 755 Mean?
  • 5. Common Linux Permission Values
    • Important
  • 6. Change Permissions With chmod
  • 7. Add and Remove Permissions Symbolically
  • 8. Set Exact Permissions With =
  • 9. Make a Script Executable
  • 10. Understand Directory Permissions
    • Read (r)
    • Write (w)
    • Execute (x)
  • 11. Why Directory x Permission Matters
  • 12. Change File Ownership With chown
  • 13. Change the Group With chgrp
  • 14. Recursive Permissions With chmod -R
    • Use recursive permission changes carefully
  • 15. Safer Recursive Ownership Changes
  • 16. Find Files With Specific Permissions
  • 17. Check Ownership Recursively
  • 18. Understand umask
  • 19. Diagnose “Permission Denied”
    • Step 1 — Check the target
    • Step 2 — Check the parent directories
    • Step 3 — Check your identity
    • Step 4 — Check group membership
    • Step 5 — Check ownership
    • Step 6 — Determine the required access
  • 20. Practical Permission Troubleshooting Example
  • 21. Linux Permission Troubleshooting Workflow
  • 22. chmod vs chown vs chgrp
  • 23. Common Permission Mistakes
    • Using chmod 777 as a fix
    • Using chmod -R without checking the contents
    • Changing ownership recursively by mistake
    • Forgetting parent-directory permissions
    • Assuming sudo fixes every permission problem
    • Ignoring groups
  • Linux File Permissions Cheat Sheet
  • Recommended Permission Patterns
    • Personal configuration or secret files
    • Normal readable files
    • Private directories
    • Executable scripts
    • Shared application directories
  • Frequently Asked Questions
    • What does chmod 755 mean in Linux?
    • What does chmod 644 mean?
    • What is the difference between chmod and chown?
    • Why does Linux say “Permission denied”?
    • Should I use chmod 777?
    • How do I make a Linux script executable?
    • How do I check who owns a file?
  • Final Thoughts
    • Related TechRunbook Guides
    • References

Linux is designed as a multi-user operating system. Different users and processes may need different levels of access to files and directories.

File permissions help control:

  • Who can read a file
  • Who can modify a file
  • Who can execute a file
  • Who can access a directory
  • Which users belong to an application’s group
  • Which services can access sensitive data

Understanding permissions is essential for:

  • Linux administration
  • DevOps
  • Cloud servers
  • Web servers
  • SSH troubleshooting
  • Application deployments
  • Cybersecurity
  • Shell scripting

1. Check Linux File Permissions With ls -l

The easiest way to view permissions is:

ls -l filename

Example:

-rw-r--r-- 1 bilal developers 1842 Sep 17 10:30 notes.txt

The first field contains the permission information:

-rw-r--r--

Break it down:

- rw- r-- r--
  │   │   │
  │   │   └── Others
  │   └────── Group
  └────────── Owner

The first character indicates the file type.

-    Regular file
d    Directory
l    Symbolic link

2. Understand rwx Permissions

Linux commonly represents permissions using three letters:

PermissionMeaningNumeric value
rRead4
wWrite2
xExecute1
-Permission not granted0

For example:

rwx

means:

read + write + execute

Its numeric value is:

4 + 2 + 1 = 7

Similarly:

rw-

is:

4 + 2 = 6

And:

r--

is:

4

3. Owner, Group, and Others

Linux permissions are divided into three main categories:

Owner
Group
Others

Consider:

-rwxr-xr--

Break it into three permission groups:

rwx | r-x | r--
 │     │     │
 │     │     └── Others
 │     └──────── Group
 └────────────── Owner

This means:

  • Owner: read, write, execute
  • Group: read, execute
  • Others: read

4. What Does chmod 755 Mean?

Numeric permissions are commonly used with chmod.

For example:

chmod 755 script.sh

The number 755 represents:

7 5 5
│ │ │
│ │ └── Others
│ └──── Group
└────── Owner

Using the permission values:

7 = rwx
5 = r-x
5 = r-x

Therefore:

755 = rwxr-xr-x

The owner can read, write, and execute the file.

The group and others can read and execute it.


5. Common Linux Permission Values

Here are several permission combinations you will frequently encounter:

NumericSymbolicTypical use
600rw-------Private files
644rw-r--r--Normal readable files
700rwx------Private directories/scripts
755rwxr-xr-xExecutable scripts/directories
750rwxr-x---Group-restricted applications
775rwxrwxr-xShared directories
777rwxrwxrwxEveryone can read/write/execute

Important

777 grants very broad permissions.

Do not use:

chmod 777 file

simply because an application reports a permission problem.

Determine which user or group actually needs access and grant only the required permissions.


6. Change Permissions With chmod

The basic syntax is:

chmod MODE FILE

Example:

chmod 644 notes.txt

Check the result:

ls -l notes.txt

You can also use symbolic permissions.

For example:

chmod u+x script.sh

This adds execute permission for the owner.

The symbols include:

u = user/owner
g = group
o = others
a = all

7. Add and Remove Permissions Symbolically

Add write permission for the owner:

chmod u+w file.txt

Remove write permission from the owner:

chmod u-w file.txt

Add execute permission for the group:

chmod g+x script.sh

Remove execute permission from others:

chmod o-x script.sh

Give the owner read and write permission:

chmod u+rw file.txt

8. Set Exact Permissions With =

You can use = to define the exact permissions for a category.

For example:

chmod u=rw file.txt

This gives the owner:

rw-

You can set permissions for multiple categories:

chmod u=rw,g=r,o= file.txt

The resulting permissions are approximately:

-rw-r-----

This can be useful when you want to remove previously granted permissions instead of simply adding new ones.


9. Make a Script Executable

Suppose you create:

backup.sh

Initially, it might not have execute permission:

-rw-r--r-- backup.sh

Trying to run it may produce:

Permission denied

Add execute permission:

chmod +x backup.sh

Then run:

./backup.sh

Verify:

ls -l backup.sh

You should see an x permission.


10. Understand Directory Permissions

Directory permissions work slightly differently from regular file permissions.

For a directory:

Read (r)

Allows a user to list directory entries.

Write (w)

Allows a user to create, delete, or rename entries, subject to other permission and filesystem controls.

Execute (x)

Allows a user to access/traverse the directory.

For example:

drwxr-x---

means the owner has full access, the group can list/traverse according to the combined permissions, and others have no permissions.


11. Why Directory x Permission Matters

Consider:

mkdir private-data
chmod 600 private-data

This may not behave as expected because directories require execute permission for traversal.

A common private-directory permission is:

chmod 700 private-data

Result:

drwx------

The owner can:

  • Enter the directory
  • List its contents
  • Create files
  • Delete files
  • Access files according to their individual permissions

Other users cannot access the directory through normal permission checks.


12. Change File Ownership With chown

Permissions and ownership are separate concepts.

Check ownership:

ls -l file.txt

Example:

-rw-r--r-- 1 bilal developers 1842 Sep 17 10:30 file.txt

Here:

bilal       = owner
developers  = group

Change the owner:

sudo chown alice file.txt

Change both owner and group:

sudo chown alice:developers file.txt

Verify:

ls -l file.txt

13. Change the Group With chgrp

You can change the group separately:

sudo chgrp developers file.txt

Verify:

ls -l file.txt

This is useful when a group of users needs controlled access to shared files.


14. Recursive Permissions With chmod -R

The -R option applies a permission change recursively.

For example:

chmod -R 755 directory/

This changes permissions throughout the directory tree.

Use recursive permission changes carefully

A directory can contain:

  • Regular files
  • Executable scripts
  • Configuration files
  • Private credentials
  • Logs
  • Databases
  • Application data

Giving every item the same permissions can create security or functionality problems.

Instead of blindly doing:

chmod -R 777 directory/

inspect the directory and determine the correct permissions for different file types.


15. Safer Recursive Ownership Changes

Recursive ownership changes can also be powerful:

sudo chown -R user:group directory/

Before using this, verify:

ls -ld directory/

and:

find directory/ -maxdepth 2 -type f -ls

Make sure the directory actually belongs to the application or user you’re targeting.

A mistaken recursive chown can affect configuration files, credentials, or files belonging to other services.


16. Find Files With Specific Permissions

The find command can help locate files with particular permissions.

Find files that are writable by everyone:

find . -type f -perm -0002 -print

Find files with exactly 644 permissions:

find . -type f -perm 0644 -print

Find executable files:

find . -type f -perm /111 -print

These commands can be useful during permission audits.


17. Check Ownership Recursively

To inspect ownership and permissions beneath a directory:

find /path/to/directory -maxdepth 2 -ls

For a simpler view:

find /path/to/directory -maxdepth 2 -printf '%M %u %g %p\n'

Example output:

-rw-r--r-- bilal developers /path/to/directory/config.txt
drwxr-xr-x bilal developers /path/to/directory/scripts

The exact find options available can vary by implementation.

Check:

man find

when necessary.


18. Understand umask

Linux uses umask to influence the default permissions assigned when new files and directories are created.

Check the current value:

umask

Example:

0022

You can also display it symbolically:

umask -S

Example:

u=rwx,g=rx,o=rx

The effective permissions for newly created files and directories depend on the application’s requested permissions and the current umask.

Do not change the system-wide umask simply to solve an individual application’s permission problem.


19. Diagnose “Permission Denied”

When Linux returns:

Permission denied

don’t immediately run:

sudo chmod 777 ...

Instead, investigate.

Step 1 — Check the target

ls -l /path/to/file

Step 2 — Check the parent directories

namei -l /path/to/file

namei can help reveal permissions along the entire path.

Step 3 — Check your identity

id

Step 4 — Check group membership

groups

Step 5 — Check ownership

stat /path/to/file

Step 6 — Determine the required access

Ask:

  • Does the user need read access?
  • Does the application need write access?
  • Does a service need execute/traverse access?
  • Should access be provided through a group?

Then make the smallest appropriate change.


20. Practical Permission Troubleshooting Example

Suppose an application cannot write to:

/opt/myapp/data

Start with:

ls -ld /opt/myapp/data

Then inspect the complete path:

namei -l /opt/myapp/data

Check the application user:

ps aux | grep myapp

Check its identity and groups:

id myapp

If the directory should belong to the application:

sudo chown myapp:myapp /opt/myapp/data

Then verify:

ls -ld /opt/myapp/data

Do not change the directory to 777 unless there is a specific, understood reason to do so.


21. Linux Permission Troubleshooting Workflow

Use this workflow when an application or user cannot access a file.

             Permission problem
                     |
                     v
             ls -l /path/file
                     |
                     v
          Check owner and group
                     |
                     v
             namei -l /path
                     |
                     v
            Check user identity
                     |
                     v
                  id user
                     |
                     v
         Does the user/group have
              required access?
                /        \
              Yes        No
               |          |
               v          v
       Investigate       Adjust
       other causes   ownership/group/
                     permissions
                          |
                          v
                       Verify
                          |
                          v
                       Test again

22. chmod vs chown vs chgrp

CommandPurposeExample
chmodChange permissionschmod 644 file.txt
chownChange owner/groupchown user:group file.txt
chgrpChange groupchgrp developers file.txt
umaskInfluence default permissionsumask 022
ls -lView permissions/ownershipls -l file.txt
statDetailed file metadatastat file.txt
nameiInspect path permissionsnamei -l /path/file

A simple way to remember:

chmod = permissions

chown = ownership

chgrp = group


23. Common Permission Mistakes

Using chmod 777 as a fix

This grants read, write, and execute permissions broadly.

Find the actual access requirement instead.

Using chmod -R without checking the contents

Different files may require different permissions.

Changing ownership recursively by mistake

A recursive chown can affect an entire application directory.

Forgetting parent-directory permissions

A file may have the correct permissions while a parent directory prevents access.

Use:

namei -l /path/to/file

Assuming sudo fixes every permission problem

sudo changes how a command is executed; it does not necessarily fix incorrect application ownership or directory configuration.

Ignoring groups

Groups are often the appropriate way to provide shared access without making files writable by everyone.


Linux File Permissions Cheat Sheet

# View permissions
ls -l file.txt

# Detailed metadata
stat file.txt

# Inspect permissions along a path
namei -l /path/to/file

# Check current user
id

# Check groups
groups

# Add execute permission for owner
chmod u+x script.sh

# Set common file permissions
chmod 644 file.txt

# Set common executable permissions
chmod 755 script.sh

# Set private file permissions
chmod 600 secrets.txt

# Set private directory permissions
chmod 700 private/

# Change owner
sudo chown user file.txt

# Change owner and group
sudo chown user:group file.txt

# Change group
sudo chgrp group file.txt

# Check default permission mask
umask

# Find world-writable files
find . -type f -perm -0002 -print

Recommended Permission Patterns

There is no single permission value that is correct for every file.

Some common patterns include:

Personal configuration or secret files

chmod 600 file

Normal readable files

chmod 644 file

Private directories

chmod 700 directory

Executable scripts

chmod 755 script.sh

Shared application directories

Use ownership and group membership deliberately rather than defaulting to 777.


Frequently Asked Questions

What does chmod 755 mean in Linux?

755 means:

rwxr-xr-x

The owner has read, write, and execute permissions. The group and others have read and execute permissions.

What does chmod 644 mean?

644 means:

rw-r--r--

The owner can read and write. The group and others can read.

What is the difference between chmod and chown?

chmod changes file permissions. chown changes the owner and optionally the group.

Why does Linux say “Permission denied”?

Possible causes include:

  • Incorrect file permissions
  • Incorrect ownership
  • Incorrect group membership
  • Missing execute permission on a directory
  • A parent directory blocking access
  • Security controls outside traditional Unix permissions

Start by checking:

ls -l /path/to/file
namei -l /path/to/file
id

Should I use chmod 777?

Avoid using 777 as a generic troubleshooting fix. It grants broad permissions and may expose files to unintended modification.

Determine which user or group needs access and grant only the required permissions.

How do I make a Linux script executable?

Run:

chmod +x script.sh

Then:

./script.sh

How do I check who owns a file?

Run:

ls -l file.txt

or:

stat file.txt

Final Thoughts

Linux permissions become much easier once you separate the concepts:

WHO?
  |
  +-- Owner
  +-- Group
  +-- Others

WHAT ACCESS?
  |
  +-- Read
  +-- Write
  +-- Execute

WHICH TOOL?
  |
  +-- chmod  → permissions
  +-- chown  → ownership
  +-- chgrp  → group
  +-- umask  → default permissions

When troubleshooting a permission problem, don’t start by making everything writable.

Start with:

ls -l
namei -l
id
stat

Identify the user, group, ownership, and required access. Then make the smallest change that solves the actual problem.

This approach is safer for Linux servers, cloud environments, Docker hosts, application deployments, and production systems.


Related TechRunbook Guides

  • 50 Essential Linux Commands for Beginners
  • How to Check Disk Space in Linux
  • How to Kill a Process in Linux
  • How to Check Open Ports in Linux
  • Docker Tutorial for Beginners
  • How to Install Docker on Ubuntu

References

  • Linux man-pages — chmod
  • Linux man-pages — chown
  • Linux man-pages — umask
  • Linux man-pages — stat
  • Linux man-pages — find

Author

Bilal Khan

Follow Me
Other Articles
GPT-6 Astra
Previous

GPT-6 Astra: What IT, Cloud, and Security Teams Need to Know Right Now

Copyright 2026 — TechRunbook. All rights reserved.