Unix/Linux (Ubuntu, Debian, Kali Linux etc.) Privilege Management

Last Updated on

File permission in Linux

1 Read: Show/Display content of the file
2 Write: Edit/Delete the file
3 Execute: Execute the bash/shell/script program etc.

Types of file permission

1 File owner: Creator of the file
2 User in the same group: Any users in the same group as the file owner
3 Other users: Any other users within other groups that doesn’t include the file owner

[email protected]:/tmp/test# ls -l
total 12
drwxr-xr-x 10 root root 4096 Jan 25 14:08 'folder 1'
drwxr-xr-x 5 root root 4096 Jan 25 14:08 'folder 2'
-rw-r--r-- 1 root root    0 Jan 25 14:12 'New Empty File'
-rwxr-xr-x 1 root root    8 Jan 25 14:09  script.s
Output of ls -lDescription
total 12Total size of all files within this folder
drwxr-xr-xd = Type of the file (directory), rwxr-xr-x = file permission
10Total hard links to this file
rootOwner name
rootOwner group
4096File size
Jan 25 14:08Time of last modification
folder 1File name
File typeDescription
lLink (Pointing to another file)
bBlock file
cCharacter file
pPipe file
Files doesn’t belong to above categories

The 9 characters “rwxr-xr-x” represents the file access privileges. They can be treated in three three groups. rwx: Owner privilege r-x: Owner group privilege r-x: Other users’ privilege

If “-” is present instead of “r” or “w” or”x” e.g. “r-x” vs “rwx”, that means the corresponding permission is disabled.

r— — —Owner can read but not write or execute.
rwx r– r–Owner can read, write, execute, Owner group and other users can only read
rwx rwx rwxEveryone can read, write, execute

Change file permission/Modify file permission

Symbolic Mode (Using Symbol and characters)

chmod [who] operator [permission] filename
Who (Character)Description
gOwner group
oOther users
aAll users (Owner, Owner group, other users)
+Add permission
Remove permission
=Set permission


chmod a-x filerw- rw- rw-Remove execute permission from all users
chmod go-w filerw- r– r–Remove write permission from owner group and other users
chmod u+x filerwx r– r–Add execute permission to Ownder

Absolute Mode – (Using numbers)

Use binary 0 and 1 to represent user permission.


Convert “111” from binary to Decimal it is “7” (4+2+1=7)


Convert “101” from binary to Decimal is “5” (4+0+1=5)

chmod 777 filerwx rwx rwxAll users, can read, write, execute
chmod 644 filerw– r– r–Owner can read, write, other users can read
chmod 444 filer– r– r–All users can read
Octal Value File Permissions Set Permissions Description 
0No permissions 
1–xExecute permission only 
2-w-Write permission only 
3-wxWrite and execute permissions 
4r–Read permission only 
5r-xRead and execute permissions 
6rw-Read and write permissions 
7rwxRead, write, and execute permissions 

Leave a Reply

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