Linux User (Group) and file permission description

Source: Internet
Author: User

Write in front:

In the Liunx system everything is a file (folders and peripherals are special files), if possible to use text files, text files are people, machines can understand the file. Linux users (groups) and permissions are the perfect solution to the Linux system security issues. Since everything is a file, Linux introduces two files to manage users (groups):/etc/passwd store users,/etc/group storage groups, and then adds the relationship information between users and files in each file header in the file system.

1. There are only two relationships between users and files: owning and not owning

2. There are only two relationships between user groups and files: owning and not owning

3, users and user groups have only two relationships, belong to and do not belong to

The above three types of relationships overlap, resulting in three relationships with users and files:

1. The user owns the file

2, the user belongs to the group, the group owns the file

3. The user does not own the file

Stored three sets of information in the file header and three relationships above

The first group, which holds the user rights to the file

The second set of permissions for the user group that holds the user's file

The third group, which holds the user rights that do not own the file

The user's permissions are divided into three types:

Read (R) (4):

File: Allow open and read content

Directory: Allows files under the directory to be listed, provided that the directory must have executable (X) permissions

Write (W) (2):

File: Allows writing to file contents or truncating files, but does not allow renaming or deleting files, renaming or deleting is determined by the permissions of the directory.

Directory: Allow new, delete, duplicate name files under the directory, if the directory has executable permissions.

Execution (x) (1):

Files: Allows files to be executed as programs, programs written in a scripting language must be set to be readable to be executed.

Directory: Enter directory

Example:

-rw-rwx--x User Group File

Each three characters is a group, each group corresponds to the owning user right, the user group permission, other user rights

Set permissions:

chmod G+RW file name

chmod g-w file name

User: U group: G Other users: O

General Web site files have the longest permission set:

777 Rwxrwxrwx

755 rwxr-xr-w User Directory permission settings

644rw-r--r--for file permission settings

Linux User (Group) and file permission description

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.