Advertisement
Guest User

File Permissions

a guest
Dec 15th, 2018
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Awk 0.99 KB | None | 0 0
  1. ### FILE PERMISSIONS, OWNERS AND GROUPS ###
  2.  
  3. "ls -l" example
  4.  
  5. drw-r--r-- 2 user wheel 4098 Dec 14 05:21 directory1
  6. -rwxr-xr-x 1 user wheel 19271 Dec 16 23:04 file2.sh
  7.  
  8. (-rwxr-xr-x) (1) (user) (wheel) (19271) (Dec 16 23:04) (file2.sh)
  9.  
  10. <permissions> <number of hard links> <owner> <group> <file size> <date> <file name>
  11.  
  12. # permissions
  13. d = directory
  14. rwx  {
  15.     r = read permissions
  16.     w = edit (write) permissions
  17.     x = execute (run) permissions
  18. }
  19.  
  20. 3 groups of rwx
  21. <owner> <group> <other> # respectively
  22. -(rwx)(rwx)(rwx)
  23.  
  24. #binary and octal
  25. 001 = 1
  26. 010 = 2
  27. 011 = 3
  28. 100 = 4
  29. 101 = 5
  30. 110 = 6
  31. 111 = 7
  32.  
  33. #if 0 = '-'
  34.  
  35. chmod <octal number> <file> # change permissions of files
  36.  
  37. ex.
  38. chmod 444 file1
  39. -r--r--r--
  40. (4 = 100 = r--)
  41. # first "-" is directory or other specific type
  42.  
  43. chmod 664 file1
  44. -rw-rw-r--
  45. # owner and group will be able to read and edit, while everyone else will only be able to read it
  46.  
  47. chown <name> <file> # change owner of file
  48. chgrp <name> <file> # change group of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement