PERMISSION MANAGEMENT:

Identities:

u

the user who own the files (owner)

g

the group to which the user belongs

o

other (everyone else)

 

Permission

File

Directory

r

read, copy, save-as a file

List directory’s items

w

write /modify to a file

Create & remove files/directories

x

execute access (if it is a program)

Directory can open


Action:

+

add permission

-

remove permission

=

exact permission

 

Examples:

g+w

add write access to the group

o-rwx

remove all permission from other

a+rw

allow everyone to read & write

ug+r

allow the owner & group to read the file

g=rx

allow only the group to read & execute (not write)

 

Numeric value of read, write and execute permission:

r w -

r – x

r - -

4+2+0

4+0+1

4+0+0

6

5

4

Where value of  r = 4, w = 2, x = 1

 

Example Numeric value of read, write and execute permission:

- r w - - - - - - -

(600)

only the owner has read and write permission

- r w – r - - r - - 

(644)

owner has read & write, group has read and other has read permission

- r w x r w x r w x

(777)

everyone has full permission

 

 Some common permission for directory:

d r w x - - - - - -

(700)

only user can read, write in this

d r w x r - x r – x

(755)

everyone can read & execute the directory, owner also have write permission


Changing file permissions and attributes

chmod ug+rw file2
giving owner and its group read and write access in file2

chmod 755 file1      
Changes the permissions of file1 to be rwx for the owner, and rx for the group and the world.
(7 = rwx = 111 binary. 5 = r-x = 101 binary)

chgrp itgroup file2     
Makes file2 belong to the group itgroup.

 

chown user1 file3    
Makes user1 the owner of file3.

 

chown -R user1 dir  
Makes user1 the owner of dir and everything in its directory tree.

 

Note:
You must be the owner of the file/directory or be root before you can do any of these things.

 

To display default permission of current user
umask  -S
(or)
umask  -p 

 

Default Umask value for:
Root user = 0022
Nonpriviledge user = 0002

Note:
Permission precedence (priority): (1) User -> (2) Group -> (3) Other

Connect With Us
Instant Query
Your Name :
Email Address :
Message :