Special permission settings for Linux study notes (s, t)

 

In addition to r, w, and x, it also contains two special permissions, s and t
①SUID SGID
SUID: chmod u+s XXXX (or chmod 4 755 XXXX, where 4: SUID, 755: ugo)
1) Only valid for binary programs
2) The executor has x executable permission to the program
3) Execute permission is only valid during that execution process
4) The executor will have the authority of the owner
 ⭐️It is convenient for other users to temporarily obtain the execution permission of the current file
 
SGID: chmod g+s XXXX (or chmod 2 755 XXXX , where 2: SGID, 755: ugo)
1) Valid for binary programs and directories
2) If the user has r, x permissions in this directory, the user can enter the directory
3) The effective user group of the user in this directory becomes the user group of this directory
4) If the user has the w permission, the user group of the new file created by the user is the same as the user group of this directory
    ⭐️The user group of the logged-in user is ignored, and the user group set in the current directory shall prevail
 
②SBIT (Sticky Bit)
chmod o+t XXXX (or chmod 1 755 XXXX , where 1: SBIT, 755: ugo)
1) Only valid for directories
2) If the user has w, x permissions on this directory, that is, they have the permission to write
3) The files and directories created by the current user in this directory can only be deleted by themselves and root.
 ⭐️Refer to /tmp, which mainly implements write protection for user data, which is convenient for data collection in the same directory.
 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326984177&siteId=291194637
Recommended