Custom Search

Monday, March 25, 2013

Linux How to remove all permissions on a file or directory and protect it

Linux How to remove all permissions on a file or directory and protect it

##Remove all permissions on directory perm_tes of Owner(u), Group(g), others(o) and all(a)
chmod 000 perm_test
or
chmod 0 perm_test
or
chmod a=--- perm_test
or
chmod a=- perm_test


##Open Read permission of Owner on directory perm_tes
chmod 400 perm_test
or
chmod u=r perm_test

##Open Read Write permission of Owner on directory perm_tes
chmod 600 perm_test
or
chmod u=rw perm_test

##Open Read Write Exec permission of Owner on directory perm_tes

chmod 700 perm_test
or
chmod u=rwx perm_test

##Open Read Write Exec permission of Owner on directory perm_tes and its all sub directories and files
chmod 700 perm_test
or
chmod u=rwx perm_test

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

##Remove all permissions on file perm_test/address.txt of Owner
chmod  u=- perm_test/address.txt

##Open Read permission of Owner on file address.txt
chmod  u=r perm_test/address.txt

##Open Read Write permission of Owner on file address.txt
chmod  u=rw perm_test/address.txt

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

##Remove all permissions on file perm_test/address.txt of group
chmod  g=- perm_test/address.txt

##Open Read permission of group on file address.txt
chmod  g=r perm_test/address.txt

##Open Read Write permission of group on file address.txt
chmod  g=rw perm_test/address.txt

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

##Remove all permissions on file perm_test/address.txt of others
chmod  o=- perm_test/address.txt

##Open Read permission of others on file address.txt
chmod  o=r perm_test/address.txt

##Open Read Write permission of others on file address.txt
chmod  o=rw perm_test/address.txt

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

##Remove all permissions on file perm_test/address.txt of owner and group
chmod  ug=- perm_test/address.txt

##Remove all permissions on file perm_test/address.txt of owner,group and others
chmod  ugo=- perm_test/address.txt

##Add Write permissions on file perm_test/address.txt for owner
chmod  u+w perm_test/address.txt

##Add Write permissions on file perm_test/address.txt for owner and group
chmod  ug+w perm_test/address.txt

##Add Read Write permissions on file perm_test/address.txt for owner and group
chmod  ug+rw perm_test/address.txt

##Remove Write permissions on file perm_test/address.txt for owner
chmod  u+w perm_test/address.txt

##Remove write permissions on file perm_test/address.txt for owner and group
chmod  ug-w perm_test/address.txt

##Remove Read Write permissions on file perm_test/address.txt for owner and group

chmod  ug-rw perm_test/address.txt

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

##Add Read Write permissions on file perm_test/address.txt for all (owner,group and others)
chmod  a+rw perm_test/address.txt

##Remove Read Write permissions on file perm_test/address.txt for all (owner,group and others)
chmod  a-rw perm_test/address.txt

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

No comments:

Post a Comment