Special Permissions:
````````````````````
setUID
setGID
Sticky Bit
setUID: Is allocated for files, so that who ever may run this file, process owner will be the owner of file(script).
chmod u+s hello.sh
hello.sh--> rw-r--r-- ==> rwSr--r--
setGID:
file: how ever my run the script, process group will be the scripts actul group.
dir: Who ever may create a file in this directory, the file group will be same as of the directory group.
ex:
# mkdir /king (owner:root, group: root)
# chmod g+s /king [rwxrwsr-x]
User kumar creates a file in this directory
hello.txt --> owner: kumar, group: root
sticky bit:
Is set only on directory so that any user can create files in this directory, but only the owner of file can remove such file, but not others
# chmod o+t /stage [rwxrwxrwt]
user: kumar
$cat > /stage/madhu.txt
ds;lfjl;sjdgl;
ctrl+z
user: madhu
$rm /stage/madhu.txt --> error
---------------------------------------------------------------------------
ACL: Access Control List
Using ACL we can give permissions to specific users/groups on a file/dir
setfacl -m : to add ACL permissions
syn: setfacl -m <whome>:<name>:<permissions> filename
ex: setfacl -m u:user1:rw hello.txt
setfacl -m u:user2:r hello.txt
setfacl -m g:dba:rwx hello.txt
setfacl -x: to remove permissions
syn: setfacl -x <whome>:<name> filename
ex: setfacl -x u:user1 hello.txt
setfacl -x u:user2 hello.txt
setfacl -x g:dba hello.txt
getfacl: to view permissions on a file
syn: getfacl filename
ex: getfack hello.txt
note: for a newly created partition we have set acl,user_xattr mount options so that files in this partition can be set with ACL permissions
tune2fs -o acl,user_xattr /dev/sda7
Comments
Post a Comment