Understanding of setuid, setgid, and sticky bits

Source: Internet
Author: User

The setuid and setgid methods are chmod 4755 program and chmod 2755 directory. Theoretically, all processes initiated by starting a program should belong to the user of the file. Therefore, setting chmod o + x program alone is not enough because it may call other programs, the role of setuid setting is in this place.
Take the su command as an example. If you only set the program permission to 751, the command still cannot be correctly executed. After the setuid is set, the command can be used by non-file owners.
Setgid is similar to setuid for executable files. setgid also has a special usage of creating a file in the directory where setgid is set, the group to which the newly created file belongs is the group to which the directory belongs.
The sticky bit has lost its role on executable files. Currently, the role of the sticky bit is limited to directories. The sticky directory is set. You can create and modify files under the directory. Only the owner of the file can delete the file or modify the file name.

Author: "advantages of Human Nature"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.