File Permissions / Types

por | 25 agosto, 2008

Permissions hard_links owner group_owner size Month day MTime name
-r-xr-xr-x 1 root bin 10196 Jan 22 2005 time

Permissions – represented by 10 bits:

0 bit = file type ( – file, d directory, b block, l symbolic link, p named pipe, s socket )

Note: remaining 9 bits are grouped into 3 groups

123 bits = r-x (entry’s owner)

456 bits = r-x ( group owner )

789 bits = r-x ( everyone )

r = read
w = write
x = execute

Unix uses octal value to represent permissions for ( rwx )

r = read = 4
w = write = 2
x = execute = 1
– = no access = 0
Total = 7

Note: 7 is max octal permission assignible to user/group/other

d rwx r-x r-x 24 root sys 1536 Aug 21 15:25 platform

rwx ( owner: root ) = 4+2+1=7
r-x ( group: sys ) = 4+0+1=5
r-x ( other ) = 4+0+1=5

/platform directory = 755 octal permissions or rwx r-x r-x

### UMASK ###

umask – get or set the file mode creation mask

umask Default for root = 0022

0777 – 022 = 644

### chmod ####
Note: chmod permits alteration of permissions on files / directories

chmod octal_value object_name ( file/directory )

u = Owner of file
g = Group
o = other
a = ALL

Add Permisions
chmod a+rw = chmod 666

Substract
chmod a-w = chmod 444 file name

chmod -R perms object_name

chmod -R u=rwx,g=rx,o=rx = chmod -R 755

Categoría: Nix