Presented by, Mr. Satish Pise Experiment No. 5 Presented by, Mr. Satish Pise
SGID, SUID and sticky bit The set user id (SUID): When a file is executed by a user, the program runs under the permissions of the file owner. The set group id (SGID): For a file, the program runs under the permissions of the file group. For a directory, new files created in the directory use the directory group as the default group. The sticky bit: The file remains (sticks) in memory after the process ends.
The SGID bit is important for sharing files.
Options for permissions ■ u for the user ■ g for the group ■ o for others (everyone else) ■ a for all of the above ■ x to assign execute permissions only if the object is a directory or if it already had execute permissions. ■ s to set the UID or GID on execution ■ t to save program text ■ u to set the permissions to the owner’s permissions ■ g to set the permissions to the group’s permissions ■ o to set the permissions to the other’s permissions Security: Minimize use of setuid and setgid programs owned by root
Assign SUID to a File : # chmod u+s testfile Assign SUID to a File : # chmod u+s testfile.txt OR # chmod 4750 testfile.txt Assign SGID to a file : # chmod g+s lpr.txt # chmod 2750 lpr.txt Here in 2750, 2 indicates SGID bitset. 7 for full permissions for owner, 5 for write and execute permissions for group, and 0 no permissions for others.
Assign StickyBit toa directory : #mkdir csedir # chmod o+t /home/csedir OR # chmod +t /home/csedir # chmod 1757 /home/csedir 1 indicates Sticky Bit set, 7 for full permissions for owner, 5 for read and execute permissions for group, and 7 full permissions for others. Check using #ls –l csedir #ls –ld csedir