File Permissions In Linux

 

permission

on a file

on a directory

r (read)

read file content (cat)

read directory content (ls)

w (write)

change file content (vi)

create file in directory (touch)

x (execute)

execute the file

enter the directory (cd)

 

File permissions for (-rw-rw-r--)
 
Syntax:
chmod <groupName>+<permissionName> <fileName> 
Example :-
chmod u+x file  < To add Permission >
chmod g-x file  < To remove Permission >

chmod u=rwx,g=rw,o=r file < To set explicit permissions >


 

Setting Octal Permissions
Octal permissions can also be set for the groups.

For example, to set r octal will be 4, to set w octal will be 2, to set x octal will be 1.


Octal Table:

binary

octal

permissions

000

0

---

001

1

--x

010

2

-w-

011

3

-wx

100

4

r--

101

5

r-x

110

6

rw-

111

7

rwx

  1. 777 = rwxrwxrwx  
  2. 765 = rwxrw-r-x  
  3. 654 = rw-r-xr--  
 
Umask :- While creating a file or directory, by default a set of permissions are applied. These default permissions are viewed by umask command.
 
mkdir -m :- The 'mkdir -m' command can be used to set the mode.
Example :-
mkdir -m 777 new1  
mkdir -m 000 new2  
 
chmod 770 /ftpdata/florad3/nabk/h2h/hsbc/outfile
 
chmod g+s /ftpdata/florad3/nabk/h2h/hsbc/outfile - stick bits
 
chmod u+s /ftpdata/florad3/nabk/h2h/hsbc/outfile
 
set uid s = having excute permissions; S = do not have excute permissions

set guid


 


Comments

Popular posts from this blog

Static IP In Linux

Bash Script