Skip to content

Instantly share code, notes, and snippets.

@mohitesachin217
Last active June 19, 2016 14:37
Show Gist options
  • Save mohitesachin217/2f022d1929ff46b55aa90356fd64d708 to your computer and use it in GitHub Desktop.
Save mohitesachin217/2f022d1929ff46b55aa90356fd64d708 to your computer and use it in GitHub Desktop.
managing file ownership and permissions for linux
ownershop
-- chmod / chgrp
permission
-- files & folder
-- chmod
-- octal
-- umask
special permissons
- SUID, GUID, stick bit
sudo chown [user]:[group] [filename]
sudo chgrp [grp] [filename]
ls -l
-rwxrwxr-x 1 root kia 9664 Jun 14 08:40 a.out
here first - indicate file type -- i.e file / folder or link
- for file
l for link
d for directory
after first character there are nine characters which specifies the permissions of the file
rwxrwxr-x
r -- read
w -- write
x -- execute
first 3 character specifies owner of the file i.e permissions for the owner of the file
second 3 characters specifies group of the file i.e permissons for the group of the file
last 3 characters specifies the permissions for the everybody else has
type | User | group | other | octal
d | 7 | 5 | 5 | r = 4
d | r w x | r - x | r - w | w = 2
- | 6 | 6 | 4 | x = 1
- | r - x | r - x | r - - |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment