Summary of permissions for the Linux system to change directories and files

Source: Internet
Author: User
Tags readable

For files that belong to you, you can change the settings of their permission bits as you want. Before changing the file permission bit settings, think carefully about which users need access to your files (including your directory). You can use the C H o d command to change the settings of the file permission bit. This command has a relatively short absolute pattern and a longer symbol pattern. Let's take a look at the symbol pattern first.

1. Symbol mode

The general format of the C h m o d command is:
chmod [who] operator [permission] filename
The meaning of W H o is:
U file is a master permission.
G Same group user rights.
o Other user rights.
A All users (file owner, same group of users, and other users).
o The meaning of P e r a t o r:
+ Add permissions.
-Remove Permissions.
= Set permissions.
P e R m i s s i o n meaning:
R Read permission.
W Write permission.
X Execute permissions.
S file owner and group S e t-i D.
t Sticky bit *.
L lock files so that other users cannot access them.
U,g,o for file owners, groups of users, and other users.

* the "T" bit is sometimes encountered when a file or directory is listed. "T" represents the viscous bit. If the "T" bit appears on a directory, this means that the files in the directory can be deleted only if they are owned by the owner, even if a group of users has the same permissions as the owner. However, some systems are not very strict on this rule.
If you see "T" in the file list, this means that the script or program will be placed in the Swap area (virtual memory) when it executes. But because today's memory prices are so low, you can ignore the use of the "T" file.

1.1 chmod Command Example

2. Absolute mode

c h M o d command The general form of the absolute mode is:
chmod [mode] File
where M o d e is an octal number.
In absolute mode, the Permissions section has a different meaning. Each permission bit is represented by an octal number, such as a table
As shown in 1-3.

In the setting of permissions, just follow the table 1-3 to find the owner of the file, the same group of users and other users have the corresponding number of permissions, and add them up, is the appropriate permission to represent.
As can be seen from table 1-3, the maximum permission value that the file owner, the same group of users, and other users can have is 7.

Take a look at the example above:
The corresponding permission representation should be 6 4 4, which means:
0 4 0 0 + 0 2 0 0 (file owner readable, write) = 0 6 0 0
0 0 4 0 (same group user readable) = 0 0 4 0
0 0 0 4 (other user readable) = 0 0 0 4
0 6 4 4
There is a better way to calculate the octal permission representation, as shown in table 1-4:

Summary of permissions for the Linux system to change directories and files

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.