Suid,sgid and sticky special privileges under Linux

Source: Internet
Author: User

Suid,sgid and sticky special privileges under Linux

Special permissions

SUID: When running the specified program, the owner of the corresponding process is the owner of the program file itself, not the initiator;

chmod u+s file increased suid bit

chmod u-s file Delete suid bit

Ls-l/USR/BIN/PASSWD is a classic example where anyone can change their password

650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M01/7F/11/wKioL1cSRMGRNlpAAADuaYB1mj8558.jpg "title=" pw.jpg "alt=" Wkiol1csrmgrnlpaaaduayb1mj8558.jpg "/>

If the file itself originally has the execution permission, then the suid display is small s; otherwise the large s is displayed;

SGID: When running the specified program, the group of the corresponding process is the genus of the program file itself, not the base group to which the initiator belongs;

chmod g+s file increased Sgid bit

chmod g-s file Delete sgid bit

If the file itself has execute permission, then suid is displayed as small s; otherwise, the large s

Sticky: In a shared directory, everyone can create files, delete their own files, but not delete others ' files;

chmod o+t file increased sticky bit

chmod o-t file Delete sticky bit

If the file itself has execute permission, the sticky is displayed as small t; otherwise the large t is displayed.

Example Description:

The company has a business unit, there are 3 users, respectively, is rose,tom,joe; need to share a directory, between each other

You can view and edit the file, but you can also create the file yourself, but you cannot delete the file created by the other party.

1. First create 3 user Rose,tom,joe, then create the sales group

Useradd Rose

Useradd Tom

Useradd Joe

Groupadd Sales

2. Add 3 additional user groups to the Sales group

Usermod-a-G sales rose

Usermod-a-G Sales Tom

Usermod-a-G Sales Joe

3. Create a public directory/tmp/sales, change this directory to sales, and increase the group write permission, and Sgid,sticky bit,

Mkdir/tmp/sales

chmod g+w/tmp/sales

Chgrp-r Sales/tmp/sales

Chmod-r G+s/tmp/sales

Chmod-r O+t/tmp/sales


This article is from the "Xavier Willow" blog, please be sure to keep this source http://willow.blog.51cto.com/6574604/1764580

Suid,sgid and sticky special privileges under Linux

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.