Guest User

Untitled

a guest
Jul 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.81 KB | None | 0 0
  1. # Linux How to remove all permissions on a file or directory and protect it
  2.  
  3. ## Remove all permissions on directory perm_tes of Owner(u), Group(g), others(o) and all(a)
  4. `chmod 000 perm_test`
  5. or
  6. `chmod 0 perm_test`
  7. or
  8. `chmod a=--- perm_test`
  9. or
  10. `chmod a=- perm_test`
  11.  
  12.  
  13. ## Open Read permission of Owner on directory perm_tes
  14. `chmod 400 perm_test`
  15. or
  16. `chmod u=r perm_test`
  17.  
  18. ## Open Read Write permission of Owner on directory perm_tes
  19. `chmod 600 perm_test`
  20. or
  21. `chmod u=rw perm_test`
  22.  
  23. ## Open Read Write Exec permission of Owner on directory perm_tes
  24. `chmod 700 perm_test`
  25. or
  26. `chmod u=rwx perm_test`
  27.  
  28. ## Open Read Write Exec permission of Owner on directory perm_tes and its all sub directories and files
  29. `chmod 700 perm_test`
  30. or
  31. `chmod u=rwx perm_test`
  32.  
  33. -------------------
  34.  
  35. ## Remove all permissions on file perm_test/address.txt of Owner
  36. `chmod u=- perm_test/address.txt`
  37.  
  38. ## Open Read permission of Owner on file address.txt
  39. `chmod u=r perm_test/address.txt`
  40.  
  41. ## Open Read Write permission of Owner on file address.txt
  42. `chmod u=rw perm_test/address.txt`
  43.  
  44. -----------------
  45.  
  46. ## R emove all permissions on file perm_test/address.txt of group
  47. `chmod g=- perm_test/address.txt`
  48.  
  49. ## Open Read permission of group on file address.txt
  50. `chmod g=r perm_test/address.txt`
  51.  
  52. ## Open Read Write permission of group on file address.txt
  53. `chmod g=rw perm_test/address.txt`
  54.  
  55. -----------------
  56.  
  57. ## Remove all permissions on file perm_test/address.txt of others
  58. `chmod o=- perm_test/address.txt`
  59.  
  60. ## Open Read permission of others on file address.txt
  61. `chmod o=r perm_test/address.txt`
  62.  
  63. ## Open Read Write permission of others on file address.txt
  64. `chmod o=rw perm_test/address.txt`
  65.  
  66. -----------------
  67.  
  68. ## Remove all permissions on file perm_test/address.txt of owner and group
  69. `chmod ug=- perm_test/address.txt`
  70.  
  71. ## Remove all permissions on file perm_test/address.txt of owner,group and others
  72. `chmod ugo=- perm_test/address.txt`
  73.  
  74. ## Add Write permissions on file perm_test/address.txt for owner
  75. `chmod u+w perm_test/address.txt`
  76.  
  77. ## Add Write permissions on file perm_test/address.txt for owner and group
  78. `chmod ug+w perm_test/address.txt`
  79.  
  80. ## Add Read Write permissions on file perm_test/address.txt for owner and group
  81. `chmod ug+rw perm_test/address.txt`
  82.  
  83. ## Remove Write permissions on file perm_test/address.txt for owner
  84. `chmod u+w perm_test/address.txt`
  85.  
  86. ## Remove write permissions on file perm_test/address.txt for owner and group
  87. `chmod ug-w perm_test/address.txt`
  88.  
  89. ## Remove Read Write permissions on file perm_test/address.txt for owner and group
  90. `chmod ug-rw perm_test/address.txt`
  91.  
  92. -----------------
  93.  
  94. ## Add Read Write permissions on file perm_test/address.txt for all (owner,group and others)
  95. `chmod a+rw perm_test/address.txt`
  96.  
  97. ## Remove Read Write permissions on file perm_test/address.txt for all (owner,group and others)
  98. `chmod a-rw perm_test/address.txt`
Add Comment
Please, Sign In to add comment