SGID & SUID & Sticky Bit

Source: Internet
Author: User
[Root @ Station home] # ll-D admins/
Drwxrwx ---. 2 root adminuser 1024 APR 9 admins/
[Root @ Station home] # chmod 1770 admins/
[Root @ Station home] # ll-D admins/
Drwxrwx -- T. 2 root adminuser 1024 APR 9 admins/
[Root @ Station home] # chmod-T admins/
[Root @ Station home] # chmod 2770 admins/
[Root @ Station home] # ll-D admins/
Drwxrws ---. 2 root adminuser 1024 APR 9 admins/
[Root @ Station home] # chmod-s admins/
[Root @ Station home] # ll-D admins/
Drwxrwx ---. 2 root adminuser 1024 APR 9 admins/
[Root @ Station home] # chmod 4770 admins/
[Root @ Station home] # ll-D admins/
Drwsrwx ---. 2 root adminuser 1024 APR 9 admins/
[Root @ Station home] # chmod-s admins/
[Root @ Station home] # chmod 7770 admins/
Drwsrws -- T. 2 root adminuser 1024 APR 9 admins/

Chmod # Ugo File
# = 1: Sticky Bit
# = 2: Set Group ID (SGID)
# = 4: Set User ID (SUID)

You can set or clear the bits with symbolic modes like U + S and G-S, and you can set (but not clear) the bits with a numeric mode.

Sticky Bit:
For directories, it prevents unprivileged users from removing or renaming a file in the directory unless they own the file or the directory; this is called the restricted deletion flag for the directory, and is commonly found on World-Writable Directories like/tmp.

Set Group ID:
For directories, file created under the directory will have the same group as Father directory.

Set User ID:
For files, user can run the program with owner's privilege.

Ref:

Man chmod

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.