Advertisement
0x2264773426

To manage file or directory permission:

Mar 28th, 2023 (edited)
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.22 KB | None | 0 0
  1. To manage file or directory permission:
  2.  
  3. To see files and directories:
  4. ls
  5.  
  6. To see files and directories (With details):
  7. ls -l
  8.  
  9. chmod = Change mode or permission of any file or directory
  10.  
  11. r = Read
  12. w = Write
  13. x = Execute
  14. l = Link/Symbolic link/Symlink (Related or a shortcut of any other file or directory)
  15. d = Directory (Represent directory)
  16. D = Door (Not common on Linux systems, but has been ported)
  17.  
  18. u = User
  19. g = Group
  20. o = Others
  21.  
  22. WITH WRITE AND EXECUTE PERMISSIONS AND WITHOUT READ PERMISSIONS:
  23.  
  24. --wx-wx-wx = Represents write and execute permission of a file (With owner, group, and others permissions)
  25.  
  26. d-wx-wx-wx = Represents write and execute permission of a directory (With owner, group, and others permissions)
  27.  
  28. l-wx-wx-wx = Represents write and execute permission of a file or directory related or a shortcut of any other file or directory (With owner, group, and others permissions)
  29.  
  30. WITH READ AND EXECUTE PERMISSIONS AND WITHOUT WRITE PERMISSIONS:
  31.  
  32. -r-xr-xr-x = Represents read and execute permission of a file (With owner, group, and others permissions)
  33.  
  34. dr-xr-xr-x = Represents read and execute permission of a directory (With owner, group, and others permissions)
  35.  
  36. lr-xr-xr-x = Represents read and execute permission of a file or directory related or a shortcut of any other file or directory (With owner, group, and others permissions)
  37.  
  38. WITH READ AND WRITE PERMISSIONS AND WITHOUT EXECUTE PERMISSIONS:
  39.  
  40. -rw-rw-rw- = Represents read and write permission of a file (With owner, group, and others permissions)
  41.  
  42. drwx-rw-rw- = Represents read and write permission of a directory (With owner, group, and others permissions)
  43.  
  44. lrw-rw-rw- = Represents read and write permission of a file or directory related or a shortcut of any other file or directory (With owner, group, and others permissions)
  45.  
  46. WITH GROUP AND OTHERS PERMISSIONS AND WITHOUT USER PERMISSIONS:
  47.  
  48. ----rwxrwx = Represents read, write, and execute permission of a file (With group and others permissions)
  49.  
  50. d---rwxrwx = Represents read, write, and execute permission of a directory (With group and others permissions)
  51.  
  52. l---rwxrwx = Represents read, write, and execute permission of a file or directory related or a shortcut of any other file or directory (With group and others permissions)
  53.  
  54. WITH USER AND OTHERS PERMISSIONS AND WITHOUT GROUP PERMISSIONS:
  55.  
  56. -rwx---rwx = Represents read, write, and execute permission of a file (With owner, and others permissions)
  57.  
  58. drwx---rwx = Represents read, write, and execute permission of a directory (With owner, and others permissions)
  59.  
  60. lrwx---rwx = Represents read, write, and execute permission of a file or directory related or a shortcut of any other file or directory (With owner and others permissions)
  61.  
  62. WITH USER AND GROUP PERMISSIONS WITHOUT OTHERS PERMISSIONS:
  63.  
  64. -rwxrwx--- = Represents read, write, and execute permission of a file (With owner and group permissions)
  65.  
  66. drwxrwx--- = Represents read, write, and execute permission of a directory (With owner and group permissions)
  67.  
  68. lrwxrwx--- = Represents read, write, and execute permission of a file or directory related or a shortcut of any other file or directory (With owner and group permissions)
  69.  
  70. WITH ALL THE PERMISSIONS OF READ, WRITE, AND EXECUTE ALONG WITH (USER, GROUP, AND OTHERS):
  71.  
  72. -rwxrwxrwx = Represents read, write, and execute permission of a file (With owner, group, and otherS permissions)
  73.  
  74. drwxrwxrwx = Represents read, write, and execute permission of a directory (With owner, group, and others permissions)
  75.  
  76. lrwxrwxrwx = Represents read, write, and execute permission of a file or directory related or a shortcut of any other file or directory (With owner, group, and others permissions)
  77.  
  78.  
  79. NO ANY PERMISSIONS:
  80. ---------- = Represents without any permission of a file
  81. d--------- = Represents without any permission of a directory
  82. l--------- = Represents without any permission of a file or a directory related or a shortcut of any other file or directory
  83.  
  84. Actions
  85.  
  86. To add:
  87.  
  88. To add readable permission to any file or directory:
  89. chmod +r [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  90.  
  91. To add writable permission to any file or directory:
  92. chmod +w [[FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  93.  
  94. To add executable permission to any file or directory:
  95. chmod +x [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  96.  
  97. To add readable and writable permissions to any file or directory:
  98. chmod +rw [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  99.  
  100. To add readable and executable permissions to any file or directory:
  101. chmod +rx [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  102.  
  103. To add writable and executable permissions to any file or directory:
  104. chmod +wx [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  105.  
  106. To add readable, writable and executable permissions to any file or directory:
  107. chmod +rwx [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  108.  
  109. To add user permission:
  110. chmod u+ [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  111.  
  112. To add group permission:
  113. chmod g+ [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  114.  
  115. To add others permission:
  116. chmod o+ [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  117.  
  118. To add user and group permissions:
  119. chmod ug+ [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  120.  
  121. To add user and others permissions:
  122. chmod uo+ [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  123.  
  124. To add group and others permissions:
  125. chmod go+ [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  126.  
  127. To add user, group and others permissions:
  128. chmod ugo+ [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  129.  
  130. To add user, group, and others permissions with [read or writable or executable permissions]:
  131. chmod ugo+[read or writable or executable permissions] [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  132.  
  133. To remove:
  134.  
  135. To remove readable permission to any file or directory:
  136. chmod -r [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  137.  
  138. To remove writable permission to any file or directory:
  139. chmod -w [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  140.  
  141. To remove executable permission to any file or directory:
  142. chmod -x [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  143.  
  144. To remove readable and writable permissions to any file or directory:
  145. chmod -rw [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  146.  
  147. To remove readable and executable permissions to any file or directory:
  148. chmod -rx [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  149.  
  150. To remove writable and executable permissions to any file or directory:
  151. chmod -wx [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  152.  
  153. To remove readable, writable, and executable permissions to any file or directory:
  154. chmod -rwx [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  155.  
  156. To remove user permission:
  157. chmod u- [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  158.  
  159. To remove group permission:
  160. chmod g- [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  161.  
  162. To remove others permission:
  163. chmod o- [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  164.  
  165. To remove user and group permissions:
  166. chmod ug- [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  167.  
  168. To remove user and others permissions:
  169. chmod uo- [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  170.  
  171. To remove group and others permissions:
  172. chmod go- [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  173.  
  174. To remove user, group and others permissions:
  175. chmod ugo- [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  176.  
  177. To remove user, group and others permissions with [read or writable or executable permissions]:
  178. chmod ugo-[read or writable or executable permissions] [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
  179.  
  180.  
  181. Another examples:
  182. chmod [u and or g and or o]+ or -[r and or w and or x] [FILE_NAME_OR_DIRECTORY_NAME_OR_PATH]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement