1. SUID
A user would write to the /etc/shadow file to change password, but he doesn't have root permission to do it.
[root@hnl ~]# ls -l /etc/shadow
----------. 1 root root 1184 Apr 30 16:54 /etc/shadow
SUID solves the problem by giving temporary root permission to the user.
[root@hnl ~]# ls -l /usr/bin/passwd
-rwsr-xr-x. 1 root root 32680 Jan 28 2010 /usr/bin/passwd
---> use s to replace user execute permissions
2. SGID
Both Linda and Lori work at the accounting group.
When Linda creates a file, the file's group ownership is her primary group: Linda. Lori cannot access this file.
SGID is used to make the directory tree (i.e. files and subdirectories)shared among the accounting group.
Both users have accounting as their secondary group. Linda's file is shared with Lori with the help of SGID.
[root@hnl data]# ls -ld account
drwxr-sr-x. 2 root account 4096 Apr 30 21:28 account
---> use s to replace group execute permission
3. Sticky bit
Lori can write to the file Linda creates.
But he is not able to delete her file, with the help of the sticky bit.
Who can delete Linda's file?
Linda or the user owner of the group directory.
[root@hnl data]# ls -ld account/
drwxr-sr-t. 2 root account 4096 Apr 30 21:28 account/
---> use t to replace others' execute permission
4. Conclusion
- When Linda creates a directory for the accounting group, she just needs to set SGID and a sticky bit to the group directory.
- All files under would have the permission as desired.
Comments
Post a Comment