Friday, September 11, 2015


Default file permission for the super user
---------------------------------------------

rwx----> owner/user who is created the file or dir

rx----> group to which owner belongs to

rx----> other people


r---->read--->4
w---->write--->2
x---->execute--->1


rwxr-xr-x ------>755---->default permission of directory


-rw-r--r----> 644----> default permission of file

-----------------------------------------------------------------------



Read (r) Write (w) Execute (x)

Files View file Modify file Execute file
contents contents

Folder list files Add & remove access file data
in dir files in dir in dir (cd /dir )





         file permission for the normal user
      -----------------------------------------



rwxrwxr-x ----->4+2+1 4+2+1 4+1----->775----default permission of directory

-rw-rw-r-- ---->4+2 4+2 4 ----->664---->default permission of a file


Permission

-rwxr-xr-x  1 root root 731 Jul 30 17:53 permissions

user
owner   grp     others
-rw- r-- r--   1 root root    5161 Jan 11 13:46 usradmin.rtf

read = 4
write = 2
execute = 1



chmod 777 <file>/<directory>
chmod u=rwx,g=rwx,o=rwx  <file>/<directory>

chmod g-w,o-w  <file>/<directory>
chmod u+rwx,g+rwx,o+rwx  <file>/<directory>


= overwrite
- remove
+ append


chmod ugo=rwx perm
OR
chmod a=rwx perm

###############################################################################

            changing ownership of folder or file

 chown owner <file/folder>
 chown sam backup

Note :- In above example sam is an owner of backup folder

 chown owner.groupowner <file/folder>
 chown owner:groupowner <file/folder>

 chown sameer.sameer backup
 chown sameer:sameer backup

###########################################################################
changing group ownership of folder or file

 chgrp grpname <file/folder>
 chgrp sam backup

###########################################################################

Special permissions



SetGID :- 2
Stickybit :- 1


setgid example
------------------

chmod g+s /project
chmod 2070 /project

set sticky bit
-----------------------

chmod o+t /project
chmod 1770 /project


##############################################################################

umask permission

Default permission for files is  :- 666
Default permission for folder is :- 777

    - how to check above statement use following command :-

 umask 000

Then create one folder and file and those permission


Note : - Default umask permission for superuser (root) is 022

 666 777
- 022         - 022
--------      --------
 644 755

files   ---> -rw-r--r--   ---> if umask is 022
folders ---> drwxr-xr-x   ---> if umask is 022


Note : - Default umask permission for any normal user is 002
       
666 777
      - 002      - 002
     --------       ----------
        664             775
     

files   ---> -rw-rw-r--   ---> if umask is 002
folders ---> drwxrwxr-x   ---> if umask is 002




No comments:

Post a Comment

Linux Tables: Block All Incoming Traffic But Allow SSH

  This is very common scenario. You want to permit access to a remote machine only by SSH. You would like to block all incoming traffic to y...