Permissions Flashcards
How to view file/folder permissions?
We can use “ls -l” command to view permissions.
How to read the following permission: drwxr-xr-x 19 djpetro djpetro 4096 Mar 30 12:02 djpetro?
d(first letter)=directory.
rwx(beginning)= owner “djpetro” has read, write and execute permissions
r-x(in the middle)=group “djpetro” has read and execute permissions
r-x(at the end)= all others have read and execute permissions.
After that we see directory information (date created, etc..)
Can permissions be set with numbers?
Yes, they were set with numbers in the past
0 - none | 1 - execute | 2 - write | 4 - read
How do we modify the permission?
Using “chmod” command
e.g. chmod u=rwx,g+w,o=rx or chmod -R 755
Where do default permissions come form?
/etc/profile - for all users
~/.bashrc - for individual user
What is umask?
Umask is a bash built-in command that is used to set default permissions for users when creating new file/folders.
Permissions are set with numbers, umask has it’s own numbering system.
e.g. umask 022 - typcal default value
How do we change owner of the file/folder?
We can use “chown” command to change both owner and group.
e.g. chown sarah:sales
How do we change just the group of the file?
We can use “chown” or “chgrp” to change file group.
e.g. chgrp sales or chown :sales
What is FACL?
File System Access Control List is basically a list referenced by file/folders for extending permissions. We can use facl to permissions for more then on user/grou to a folder/file.
We manage list entries with setfacl /getfacl commands.
e.g. setfacl -m u:sarah:rwx
Are FACL’s available on all distros?
Mostly, but on some distros must be enabled with acl option in /etc/fstab
RedHat enables it by default
Are group FACL permissions handled the same way as user?
Similarly
Do FACL works on directories as well?
Yes, we can use inheritance as well
Are there any other advanced permissions besides FACL?
Sticky bit - protects files/folders from renaming or deletion
Files/folders with sticky bit can only be renamed/deleted by root user