Rights Management under Linux

Source: Internet
Author: User

Linux files have three identities and four permissions, and three identities are:
U: Owner of File
G: The group to which the file belongs
O: Other users
For each identity, there are four different permissions, namely:
R: Permission to read files (read)
W: Permission to write to file (write)
X: Execute permission (execute)
S: Special Permissions
In the Linux file permissions explained in detail, we know that there are two ways to represent file permissions in Linux, respectively, the number and symbol representation.
chmod changing file permissions in digital form
chmod 755 test.sh
Convert 755 into character form, rwxr-xr-x, that is, the file owner, group and other users can read and run test.sh this file, but only the owner can write to this file, that is, other people do not have permission to modify test.sh


This file. (Of course, the root user does not have this limitation, who wants to change who, this is also an experience that embodies the supremacy of root account!) )
To change the permissions of the file through the mathematical form is relatively simple, as long as the implementation of the permissions required to give the file, and then call the chmod instruction, the call form is:
chmod New Permissions File list
chmod changing file permissions as characters
chmod +x test.sh
The mathematical form can change the file of all three identities of four kinds of permissions, and the character is more flexible, you can give an identity of a certain permission to set a separate, such as the above instruction is to give three kinds of identities to give execution permissions, you can also separate


Set up:
chmod u+x test.sh Only add executable permissions to the owner
chmod g+x test.sh Only add executable permissions to group identities
chmod o+x test.sh Only add executable permissions to other people
All of the above three directives are combined to be equivalent to the one above, which is the ability to turn on executable permissions for all identities, and you can do the following as well:
chmod a+x test.sh
The A here represents all of the 3 identities!
If you want to remove a certain privilege from an identity, you only need to change the + to-can, for example, remove the executable permission for someone else's identity:
chmod o-x test.sh
For read, write and other permissions, follow the above way to practice more, chmod through the character of the file permissions to change the operation see the following table:
chmod U
G O A
+ (plus)-(minus) = (set)
R W X
File or directory
Finally, a comprehensive example, after a similar problem extrapolate can:
chmod u=rwx,g+rx,o-x test.sh

Rights Management under Linux

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.