Relationship of Linux roles and permissions

Source: Internet
Author: User

Basic permissions include 3 types: R-Read, W-write, X-Execute

Roles are also divided into 3 categories: U-owning, G-owning group, o other


R, W, x correspond to 4, 2, 1, respectively

You can set permissions using U, G, O + R, W, X, or directly using numeric values such as 755


* When the directory has write permissions, the representative can add to the directory, delete, empty, and so on, and the directory under the specific permissions of the file Independent

When you have write permission on a file, you can only modify the contents of the file, not the delete operation.


Special permissions

Setuid,setgid, the sticky bits correspond to 4,2,1 respectively.

Sticky bit meaning: the sticky bit of the directory indicates that the files in this directory can only be deleted by owner and Root, and the TMP directory is an example

Ll/tmp permissions for drwxrwxrwt,t for sticky bits

How to set: chmod 1755 dirname


Setuid and Setgid

Setuid only works on commands and executables/usr/bin/passwd is an example

Ll/usr/bin/passwd-rwsr-xr-x,s Representative setuid

How to set: chmod 4755/usr/bin/passwd or chmod u+s/usr/bin/passwd

On behalf of the executor of the command is performed by the owner of the command.


Setgid only works for commands and executables

How to set: chmod 2755 xxx or chmod u+s xxx

The performer on behalf of the command is executed in the same group as the command.

Example: Modify/bin/mkdir chmod G+s/bin/mkdir

Switch to a non-root user, execute mkdir, view the owning group of the mkdir, the group that belongs to is root, not the current user's group




Relationship of Linux roles and permissions

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.