Skip to content

Instantly share code, notes, and snippets.

@basedalexander
Last active March 16, 2018 22:43
Show Gist options
  • Save basedalexander/2600e25ac58c88c44f348e7b37421e24 to your computer and use it in GitHub Desktop.
Save basedalexander/2600e25ac58c88c44f348e7b37421e24 to your computer and use it in GitHub Desktop.
chomod 720 file_or_dir
# 1) 7 - owners rights
# 2) 2 - right for users who belongs to the owner's group
# 3) 0 - other users
# 4 - read
# 2 - write
# 1 - execute
# Change the owner of a file
# ls -lart tmpfile
-rw-r--r-- 1 himanshu family 0 2012-05-22 20:03 tmpfile
# chown root tmpfile
# ls -l tmpfile
-rw-r--r-- 1 root family 0 2012-05-22 20:03 tmpfile
# Change the group of a file
#ls -l tmpfile
-rw-r--r-- 1 himanshu family 0 2012-05-22 20:03 tmpfile
chown :friends tmpfile
#ls -l tmpfile
-rw-r--r-- 1 himanshu friends 0 2012-05-22 20:03 tmpfile
# Change both owner and the group
# ls -l tmpfile
-rw-r--r-- 1 root family 0 2012-05-22 20:03 tmpfile
# chown himanshu:friends tmpfile
# ls -l tmpfile
-rw-r--r-- 1 himanshu friends 0 2012-05-22 20:03 tmpfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment