Linux Command learning: chmod

Source: Internet
Author: User

The chmod command is used to change the permissions of a file or directory. In the Linux system family, the control of file or directory permissions is distinguished by reading R, writing W, performing X3 general permissions respectively, and 3 special permissions are available for use. The user can use the chmod instruction to change the file and directory permissions, the format of the use of text or digital code can be. The permissions of the symbolic connection cannot be changed, and if the user modifies the permissions on the symbolic connection, the change will affect the original file being connected.

The representation of a permission range is as follows:

user, which is the owner of the file or directory; u
Group, which is the group that owns the file or directory; g
other, except for the file or directory owner or group, other users belong to this scope; o
all, that is, all users, including owners, groups and other users; a
Read permission, the number code is "4"; r
Write permission, the number code is "2"; w
Execute or toggle the permission, the number code is "1"; x
without any permission, the number code is "0"; -
Special Feature Description: Change permissions for a file or directory. s

Grammar

chmod file

Description: Linux file Call permissions are divided into three levels: file owners, groups, and others. The use of chmod can be used to control how files are called by others.

Mode: Permission set string in the following format: [Ugoa ...] [[+-=][RWXX] ...] [,...], where:

U represents the owner of the file, G means that the owner of the file belongs to the same group (group), and O indicates that the other person, a means that all three are.
+ indicates an increase in permissions,-represents a cancellation permission, = Represents a unique set of permissions.
R is readable, w means writable, x is executable, x means only if the file is a subdirectory, or the file has been set as executable.
-C: If the file permissions have changed, then the change action is displayed.
-F: Do not display an error message if the file permissions cannot be changed.
-V: Displays the details of the change of permissions, showing the instruction execution process.
-r:recursive (recursive), the same permission changes are made to all the files in the current directory and subdirectories (that is, they are changed individually in a recursive manner).
--help: Displays the auxiliary description.
--version: Displays the version.

< permission scope >+< permission setting;: The option permission setting for the file or directory on which the permission is opened;
< permission scope >-< permission setting;: Close the permission settings for the file or directory of the permissions range;
< permission scope >=< permission setting;: Specifies the permission setting for the file or directory of the permissions range;

Knowledge Supplement

Linux users are divided into: owners, groups (group), others (other), Linux system, in a preset situation, all the accounts in the system and the general identity user, as well as the root of the relevant information is recorded /etc/passwd in the file. Each person's password is recorded /etc/shadow under the file. In addition, all the group names are /etc/group recorded inside!

Permission Types

R= Read Property//value =4
W= Write property//value =2
X= Execution Properties//value =1

Linux Command learning: chmod

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.