File permissions in linux

By Team Clofus Innovations | Mon Jan 17 2022

Like unix, linux os is also multi user operating system. So we need to protect files from authorized users. Where linux file permission is used.

Each file or directory have three set of permissions. Owner permission, group permission, everyone permission.

Each permission have three set of actions. read, write and execute. Users can change permission of each file in linux operating system.

file permissions linux

How to view file permission ?

Type this command in your linux terminal

 $  ls -l

Now all files and directory in present working directory, display with their corresponding permission like shown as below:

-rw-r-xr-x  1 root root     382 Apr 18 22:24 
          sample.txt
          drw-r--r--  1 root root     382 Apr 18 22:24 
          sample
          -rw-r-xr-x  1 root root     382 Apr 18 22:24 
          clofus.md

How to change file permission?

Type this command in your linux terminal

$ chmod  -R 755 < folder or file path >

_ _

Read = 4, write = 2, execute = 1

755 denotes file permission of folder or file. - 7 - owner permission, ( 4+ 2 + 1 = 7 ). It means owner of file have permission to read, write and execute. - 5 - group permission, ( 4+ 0 + 1 = 7 ). It means users in group have permission to read, execute only. They are not allow to edit this file. - 5 - everyone permission, ( 4+ 0 + 1 = 7 ). It means every other linux users in the operating system have permission to read, execute only. They are not allow to edit this file.

For more permission is listed below:

7  = read + write + execute 

6 = read + write 

5 = read + execute

4 = read only

3 = write and execute only

2 = write only 

1 = execute only

Contact Us

+91 72003 71486
173 TECCI Park, 6th Floor, OMR, Sholinganallur, Chennai, Tamil Nadu 600119.
*Please complete all fields correctly
Whats App