Understanding And Learning File Permissions in Linux OS

In this article, we will discuss, Why do we use file permission in Linux/Unix?

Linux is a clone of the UNIX operating system, it is a multi-user operating system, which can be accessed by many users at a time.

Because of this, it raises the question of its security, that it can be easily corrupted or anyone can change or remove the crucial data.

So, taking care of the security.


Linux divides authorization level into 2 levels





In Linux the system is allocated 3 types of owner

→ The first one is “User

Owner of the file. The person who creates the file is called the owner.

→ The second one is “Group

In a group there can be multiple users we can put multiple users in a group and assign the same file permission.

→ The third one is “other

Other can be anybody except user & group


For every user, group & other there is set permission

  1. Read 
  2. Write 
  3. Execute


User → rwx

Group → rwx                                            (-) → file -rw-rwxrw-

Other → rwx                                             (d) → directory drw-rwxrwxrw-


Read – Gives the permission to read the file,

Write – Gives the permission to modify the file it gives the authority to add, remove, rename the file which is stored in the directory.

 Execute – we cannot open the file if the execute permission is not given to the file.

Example:- Understanding and learning file permissions in Linux OS


Show directory or file if directory (d) sign shows in starting

If file (-) hyphen sign show in starting

first (rwx)

Permission of user (read,write,execute)

Second (r-x)

Permission of group (read,-,execute)

Third (r-x)

Permission of other (read,-,execute)


r  refer to  read permission


w  refer to write permission


x  refer to execute permission

Give permission to file and directory has two way
1. Symbolic method
2. Octal method / numerical method

(chmod) command use to change permission

Default permission of file :-

Symbolic method

Symbolic method is used alphabets to set permission.



u refer to user


g refer to group


o refer to other


Use to add permission


Use to remove permission


Use to overwrite permission



Create “mydir” directory
1. add  write permissions to group on mydir (# chmod g+w mydir)

2. Give only execute permission to other (# chmod o=x mydir)

3. Remove write permissions to user (# chmod u-w mydir)

Octal or numeric method

Octal method use numbers to set permission




No permission



Execute permission



Write permission



Write and execute permission



Read-only permission



Read & execute permission



Read & write permission



All permission


example:- use octal method to give permission

chmod user|group|other file/directory path
1. # chmod 755 mydir (this command give permission to mydir user have all permissions, group & other have only read and execute permission.)

Special permission

1. Setuid (set user id)
2. Setgid (set group id)
3. Sticky bit

1. setuid :- setuid is the permission bit that allows the user to execute a command/ program with the permission of its owner. Setuid permission are used to tell the system to run an executable file as the owner with the owner’s permission.

Symbolic method to setuid —># chmod u+s file_name (This command use to setuid bit on file)

Octal method to setuid —># chmod 4766 file_name (This command use to setuid bit using  octal method)

Remove setuid bit —># chmod u-s file_name (This command use to remove the setuid bit form file)

2. Setgid :- setgid is a bit that allows the user to execute a program with the permission of the group owner.

Symbolic method to setgid  —># chmod g+s file_name (This command use to setgid bit on file)

Octal method to setgid —># chmod 2766 file_name (This command use to setgid bit using octal method)

Remove setgid bit —> # chmod g-s file_name  (This command use to remove the setuid bit form file)

3. Sticky bits :- A sticky bit is a permission bit that is set on a directory that allows only the owner of the file within that directory or the root user to delete or rename the file. No other user has the needed privileges to delete the file created by some other user.

Symbolic method to set sticky bit  —># chmod +t file_name (This command use to set the sticky bit on file and directory)

Octal method to set sticky bit —># chmod 7660 file_name (This command use to set stickybit using octal method)

Remove sticky bit —> # chmod -t file_name  (This command use to remove the sticky bit)


By following this tutorial you will learn what are the permissions as well as special permission in Linux/Unix.

Learn how to scale, manage, and optimize your applications with a SLB. Read our solution brief "Get More from Your Enterprise Network".


Get started with CloudMinister Today