Linux system user permissions, groups

Source: Internet
Author: User
Article Title: linux system about user permissions and groups. 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.

In addition to r, w, and x, file permissions include s, t, I, and:

S: Set SUID and GUID for the file owner and group. The file will be executed as root after the s permission is set. When setting the s permission, the corresponding x permissions must be set for the file owner and group; otherwise, the s permission cannot take effect properly (the c h m o d command does not perform necessary integrity checks, chmod does not report an error even if the s permission is set without the x permission. When we see rwS in ls-l, the S permission is invalid in uppercase ). In Linux, passwd is a program with SUID set. Normal users can change their passwords without the permission to read/etc/shadow files.

Ls-al/usr/bin/passwd

-Rwsr-xr-x 1 root 32988/usr/bin/passwd

We can set the s permission in character mode: chmod a + s filename, or set it in absolute mode:

Set s u I d: Set the one before the corresponding permission bit to 4;

Set g u I d: Set the one before the corresponding permission bit to 2;

Both are set to 4 + 2 = 6.

For example: chmod 4764 filename // set SUID

T: Set the adhesion bit. A user who can read and write a file must have the permission to delete the file. If the file has the t permission set, only the owner and root have the permission to delete the file, use chmod + t filename to set t permissions.

I: permission cannot be modified. For example, if chattr u + I filename is used, the filename file cannot be modified. If you need to modify the file, delete the I permission first and use chattr-I filename. Check whether the file has set the I permission to use lsattr filename.

A: Only append permissions are available for the log system. This permission allows the target file to be appended, not deleted, and not appended through the editor. You can use chattr + a to set the append permission.

In linux, the user in A folder is A and wants to change it to user B! How to Use usermod?

Su to root

Chown B yourdir

Chgrp B yourdir

In the group file:

Zzg: x: 550: litong, liuhong

What does this mean? What does that number mean?

In passwd:

Liuhong: x: 544: 550:/usr/local/resin/webapps:/bin/bash

What does the number mean?

How can I change the liuhong permission?

Linux is a multi-user, multi-task operating system ), other users that can share the system can be divided into users in the same group (group users) and users in different groups (other users ).

Zzg: x: 550: litong, liuhong

Group name zzg password x in shadow Group ID number 550 users in the group have litong, liuhong

Liuhong: x: 544: 550:/usr/local/resin/webapps:/bin/bash

Username liuhong password x in shadow user ID544 group ID550 description is empty user home directory/usr/local/resin/webapps initial logon shell is/bin/bash

Modify the o-rwx attribute of the specified directory to restrict access by other users. Change the user's group to a non-directory group;

You can also modify the go-rwx attribute of a specified directory to restrict access from other users and members of this group.

The root user uses chown and can specify the File Permission to the user. the user's own file can use chmod to set the file access permission.

Permission change: chmod g + w Folder/file name

Chmod o + w Folder/file name

Related Article

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.