Basic Premission

Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

Access to any file or directory in Linux are controlled by file

permission.
1. Basic Permission
2. Special Permission
3. Access Control List (ACL) Permission
Linux basic file permission is very simple and flexible to apply.
#ls -l /notes.txt

-rw-r—r--. 1 root root 0 Jan 4 14:59 /notes.txt

Permission
Link
Owner
Group owner
Size of file
Date & time of file creation
Name of file
#ls -ld /india
There are three permissions groups:
 Owner
 Group
 Other
Permission Description

Owner (u) Permissions used for the owner of the file

Group (g) Permissions used by members of the group

Other (o) Permissions used by all other users


Permission Access for a file Access for a directory
Read (r) display file contents and copy the View contents of directory
file.

Write (w) modify the file contents. modify the contents of a directory.

Execute (x) execute the file if it is an Allow use of cd command to


executable. access the directory
Number Permission Type Symbol
0 No Permission ---

1 Execute --x
2 Write -w-
3 Execute + Write -wx

4 Read r--
5 Read + Execute r-x

6 Read +Write rw-


7 Read + Write +Execute rwx
For add read permission to owner
#chmod u+r /notes.txt

For add read write permission to group


#chmod g+rw /notes.txt

For remove read permission to others


#chmod o-r /notes.txt
Syntax:
#chown <user name> <file/directory name>

eg.
#chown ajay /notes.txt
Syntax:
#chgrp <group name> <file/directory name>

eg.
#chgrp ibmgrp /notes.txt
r (read) = 4
w (write) = 2
x (execute) = 1

For set permission with numeric value


#chmod 751 /india

You might also like