Linux Special Permissions suid, SGID, Sbit
First, SUID
Let's start by looking at a file, as follows:
[Email protected] ~]# LL/USR/BIN/PASSWD
-rwsr-xr-x. 1 root root 25980 February 2012/usr/bin/passwd
Can see/usr/bin/passwd This file status is "-rwsr-xr-x", rather than our usual familiar "-rwxr-xr-x", then when s appears in the file owner's X permission, this time is called the set UID abbreviation SUID.
When you run the program with a user who does not have the appropriate permissions, you can access resources that he does not have permission to access.
(1) Suid permissions are valid only for binary executable files;
(2) The performer has X permission for the file;
(3) This authority is valid only in the process of executing the document;
(4) The performer will have the permission of the owner of the file.
For example, a normal user modifies his or her command with passwd, and in effect eventually changes the/etc/passwd file. This file is a user-managed profile that can only be changed with root permissions.
Image
Since it is the root user who has this permission, why we can change the password through the passwd command, which is due to passwd set the SUID permission bit.
Image
At this time, the ordinary user by executing the passwd command, temporary root permissions, and indirectly modify the/etc/passwd to achieve the right to modify their own password.
2 SGID
When s appears in the directory or the file belongs to the group's X permission, this is called the set GID abbreviation Sgid, that sgid to the file and directory division what function?
2.1 Sgid to the directory
Users can enter this directory if they have r and X permissions for this directory
A group of users in this directory will become a group of that directory
If the user has permission to W in this directory (can create a new file), the new file created by the consumer will be the same as the group for this directory
2.2 Sgid to File
SGID valid for binary executable files
The program performer must have x permission for the file.
The performer will receive support for the file group during execution (to change the permissions of the file group)
3 Sbit
When s appears in the directory other user's X permission, at this time is called sticky bit abbreviation sbit, that sbit have what restriction and function?
This article is from the "Hand of the Paladin Control" blog, please make sure to keep this source http://wutengfei.blog.51cto.com/10942117/1926420
Linux Special Permissions suid, SGID, Sbit