Skip to content

Instantly share code, notes, and snippets.

@sourabh-upadhyay
Last active July 27, 2017 16:21
Show Gist options
  • Save sourabh-upadhyay/32c1d1b271c4c59bd53d663d107f3534 to your computer and use it in GitHub Desktop.
Save sourabh-upadhyay/32c1d1b271c4c59bd53d663d107f3534 to your computer and use it in GitHub Desktop.
Permission on linux
Number Octal Permission Representation Ref
0 No permission ---
1 Execute permission --x
2 Write permission -w-
3 Execute and write permission: 1 (execute) + 2 (write) = 3 -wx
4 Read permission r--
5 Read and execute permission: 4 (read) + 1 (execute) = 5 r-x
6 Read and write permission: 4 (read) + 2 (write) = 6 rw-
7 All permissions: 4 (read) + 2 (write) + 1 (execute) = 7 rwx

Example

$ chmod 755 testfile
$ls -l testfile
-rwxr-xr-x  1 amrood   users 1024  Nov 2 00:10  testfile
$chmod 743 testfile
$ls -l testfile
-rwxr---wx  1 amrood   users 1024  Nov 2 00:10  testfile
$chmod 043 testfile
$ls -l testfile
----r---wx  1 amrood   users 1024  Nov 2 00:10  testfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment