Linux Permissions Table and Guide

Common File Permissions

Setting Numerical Meaning
-rw------- (600) Only the owner has read and write permissions.
-rw-r--r-- (644) Only the owner has read and write permissions; the group and others have read only.
-rwx------ (700) Only the owner has read, write, and execute permissions.
-rwxr-xr-x (755) The owner has read, write, and execute permissions; the group and others have only read and execute.
-rwx--x--x (711) The owner has read, write, and execute permissions; the group and others have only execute.
-rw-rw-rw- (666) Everyone can read and write to the file. (Be careful with these permissions.)
-rwxrwxrwx (777) Everyone can read, write, and execute. (Again, this permissions setting can be hazardous.)

Common Directory Permissions

Setting Numerical Meaning
drwx------ (700) Only the user can read, write in this directory.
drwxr-xr-x (755) Everyone can read the directory; users and groups have read and execute permissions.

Numeric Meanings

Numeric Readable Explanation
0 No access.
1 –x Execute access.
2 -w- Write access.
3 -wx Write and execute access.
4 r– Read access.
5 r-x Read and execute access.
6 rw- Read and write access.
7 rwx Read, write and execute access.

To View Permissions

To list file permissions for filename.txt:

ls -l filename.txt

To list directory permissions for /dirname:

ls -ld /dirname

To Change Permissions

To change permissions of file or directory to 644 for example:

sudo chmod 664 foo.txt

Let me know in the comments if this helped. Follow me @DevAnswers or buy me a beer 🍺

Feedback

Your email address will not be published. Required fields are marked *

We use Markdown to style comments, like on Github and Reddit.
To do a line break, type two spaces after the sentence.
You can add inline code by wrapping it in backticks: `code here`

    To do an entire block of code  
    type four spaces before the line
    and it will appear in a block like this.
    <-- four empty spaces