Setuid and setgid

Source: Internet
Author: User
Title: setuid and setgid. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Create a new family as a public group

Groupadd family

Create two user shuai hongyan password settings

Useradd shaui

Useradd hongyan

Passwd shuai

Passwd hongyan

Add these two users to the two groups

Usermod-G family shuai

Usrmod-G family hongyan

Create a directory share under the current directory

Mkdir share

Specify the owner group of this directory to family.

Chown: family share

View share Permissions

Ll-d share

Use shuai to try writing

Cd share

Touch shuai.

Ll shuai. a. Check that the group to which the file belongs is still shuai.

Then set it to setgid.

Chmod g + s share

We specify the directory owner to the family group.

Chown: family share

And set w write permission for it to allow users in the group to write permission to create an environment for the experiment

Chmod g + w share

If setgid is not specified

Let shuai users establish a file production view group

Touch shuai. B

Ll shuai. B

Let the hongyan user go in and delete it.

Rm shuai. B

Yes.

Then we create the stickty bit permission for share.

Chmod o + t share

Switch to shuai user

We will find that even if there is a setgid, it is no longer possible to delete other hot files.

Then set the gid so that they can go in and set the file to view the group.

Then it can be deleted.

Finally, we set stickty bit for this file.

Then, the shuai user is used to delete the hongyan user's file and an error is prompted.

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.