In-depth discussion of Linux permissions

Source: Internet
Author: User

1. How to view file permissions

1) Master Use the Ls–l command to view the permissions set on the file.

Drwxr-xr-x. 2 root root 6 binfmt.d

Permissions information hard-link number is the main genus group File size file creation time filename

2) Master the ls–l command display results in the first column is divided into 4 groups, wherein;

D rwx r-x r-x.

A) The 1th character is the 1th group, which is either a file (-) or a directory (d), or another resource.

-: Normal file D: Directory file L: Soft link B: Device p: Piping file

b) The 2nd, 3, 4 characters are Group 2nd, which defines the limited rights of the owner (owner) of the file or directory, and uses U to represent all the permissions of the owner (owner) on the file.

c) The 5th, 6, 7 characters are Group 3rd, which defines the permissions that other (users) have in the group where the owner of the file or directory resides, using G for this group permission.

D) 8th, 9, 10 characters are Group 4th, which defines the permissions that are not owner or other users of the same group as owner on the file or directory. Use o to represent this group (other) permission.

3) Master the owner and the group of the third and fourth column in the display result of the Ls–l command.

2. Root user and file security control

1) Master the definition of the root user: The root user, also known as the Superuser, has unrestricted access to any user's account and all files and directories.

2) Understand the classification of users in Linux systems:

The Linux system divides all users in the system into 3 categories:

A) class 1th: Owner

b) class 2nd: Same group of users (FIX: Owning group, because the process of creating a user will create a group with the same name as the user name)

C) Class 3rd: Other users not in the same group

3) The ability to master file operations includes reading (read), write, and execute (execute)

4) master the Linux operating system when displaying permissions, use the following 4 characters to indicate file operation permissions:

A) R: Represents the Read permission, which is the ability to read the file or the LS command to list the contents of the directory.

b) W: Represents the Write permission, which is the right to edit the file or create and delete files in a directory.

c) x: Represents execute permissions, that is, the ability to execute a program or switch to this directory with the CD command, and to use the LS command with the-l option to list the permissions for the details in this directory.

D)-: indicates no corresponding permission (corresponds to R, W, or X at the location).

3. Master of modifying files using Chown

Chown: Genus Group File

Chown: Genus Group File

Chown Master File

A) For example, the command that modifies the file file1 is root: chown root file1

4. Mastering the genus Group that uses CHGRP to modify files

CHGRP Group File

A) For example, the command to modify the genus of the file File1 for WG is: CHGRP WG file1

5. Use the notation method to set permissions on a file or directory

1) Master the function of the chmod command: Set or change permissions on the file or directory.

2) Master-r option: not only set (or change) the directory permissions, but also recursively set (or) Change permissions for all files or subdirectories in that directory.

3) Mastery is the definition of symbolic notation:

Symbolic notation is the use of several specific symbols to set the state of a permission.

4) The State of authority can be divided into 3 parts:

A) The 1th section, which indicates whose permission state to set or change. The specific expressions are as follows:

U: Represents the owner's permission.

G: Represents the permissions of the group.

O: Represents a permission that is neither owner nor other user (other) with owner in the same group.

A: Represents the permissions of the above 3 groups, that is, all users (all).

b) The 2nd part, is the operator (operator), also known as the operator, wherein the specific expression is as follows:

+: Indicates permission to join

-: Means remove permissions

=: Indicates set permissions

c) Part 3rd, indicating the authority (permission), in which the specific expression is as follows:

R: Indicates read (read) permission.

W: Indicates write permission.

X: Represents the Execut (execute) permission.

5) flexibly apply symbolic notation to set or change permissions on a file or directory:

A) For example: Add the command for the owner and the same group of users to execute permissions on the Dog_wolf file:

chmod ug+x Dog_wolf

b) For example: The command to add write permissions to other users on the Babydog directory:

chmod o+w Babydog

6. Use digital notation to set permissions on a file or directory

1) Master the definition of digital notation:

Numeric notation refers to the use of a set of three-digit numbers to represent the state of permissions on a file or directory. which

The 1th number represents the owner's permission (U).

The 2nd number represents the permissions of the group (g).

The 3rd number represents the Permissions (o) for other users (other).

2) The number represents the resource permission state:

4: Indicates a read permission.

2: Represents a Write permission.

1: Indicates that there is execute (EXECUTE) permission.

0: Indicates that there is no corresponding permission.

3) Flexible application of digital notation to set or change permissions on a file or directory:

A) For example: use digital notation to open the/home/dog/babydog directory and all of the permissions for all files in the owner, but to open read and execute permissions to the same group of users, and to open only read permissions to other users of the command:

Chmod-r 754/home/dog/babydog

In-depth discussion of Linux 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.