Skip to main content

File permission in Linux

 

 There are seven types of files in linux.

- Regular File

d directory

b block device file

c character device file

s socket file

p pipe file

l link file

Assigning permission

Syntax: chmod  (u/g/o/a)  (+/-/=) (r/w/x/-)  <file name/path>


u - user

g -group

o - others

a - all


r read

w write

x execute


+ add permission

- remove permission

= assign permission


Permission using numbers

4 read

2 write

1 execute


Changing ownership


Syntax: chown <username>:<groupname> <file / directory name>


Access control list


setfacl -m u:<username>:<permission>  <file name>

sefacl -x  u:<username> <file name>

getfacl <file name/directory>

 

Special permissions

suid
sgid
sticky bit

Comments