Chmod command in Linux

Source: Internet
Author: User

1. chmod is a command for changing file permissions in linux. Common Commands include:

(1) sudo chmod u + x

(2) sudo chmod g + x

(3) sudo chmod o + x

The u, g, and o represent user, group, and others respectively. "+" indicates granting permissions, and x (executable) indicates executable permissions.

2. What does sudo chmod 777 mean:

The three digits represent the permissions of the user, group, and others respectively. The Readable (r), writable (w), and executable (x) permissions are represented by numbers 4, 2, and 1, respectively, number 7 is the sum of permissions 4, 2, and 1. 777 indicates that user, group, and others have the readable (r), writable (w), and executable (x) permissions, is the highest permission.

3. This is a simplified article I wrote. I will provide a more detailed introduction to this article on the Internet, with the following link:

Http://blog.csdn.net/linuxgroup/article/details/4247858

For convenience, I have directly reproduced one copy. Thanks to the original author!

 Command

Change the file mode.

Use a symbol to change the file type

-R] [-h] [-f] [[u] [g] [o] | [a] {-| + |=} [r] [w] [x] [X] [s] [t]} {File... | Directory ...}

Use numbers to change the file type

-R] [-h] [-f] PermissionCode {File... | Directory ...}

Command to modify the path and specify the extended access control table () for files or directories (). It can be defined by symbols or numbers (in full mode ).

When you encounter a symbolic link without specifying a flag, the command changes the method of pointing to the file or directory through the link, rather than the link itself. If a flag is specified, the command prevents this method from being changed.

If you specify a flag and a flag, the command recursively drops the specified directory and does not change the file or directory to which the link points when a symbolic link is encountered.

Disable all error reports (except invalid permissions and usage statements ).

When a symbolic link points to a directory, you can change the file path of the directory without traversing the directory.

Symbol Mode

To specify the flag format, you must specify three flag sets.

The First Flag sets the target user or denied the specified permission, as described below:

File owner.

The group and extension entries inherent in the file group.

All other entries.

Users, groups, and all other entries. A flag has the same effect as a specified flag. If these flags are not specified, the default value is flags and the mask () is created for the application file ().

The second flag set specifies whether to remove, apply, or set the permission:

Remove the specified permission.

The permission specified by the application.

Clear the selected permission field and set it to the specified permission. If no permission is specified, the command removes all permissions from the selected field.

The third Flag Set specifies the permission to be removed, applied, or set:

Read permission.

Write Permission.

Permission for File Execution and permission for Directory Search.

Permission to search for directories.

If a flag is specified or hidden, the user identity permission for execution is set. If a flag is specified or hidden, set the group identity permission during execution.

For a directory, it indicates that only the file owner can link or unlink the file in the specified directory. For files, it sets properties.

Number or full Mode

The command also allows you to use the octal notation for this method. A number is a summary of one or more of the following values:

Set the user ID for execution.

Set the group ID for execution.

Set the link permission for the directory or set properties for the file.

Allow the owner to read.

Allow the owner to write data.

Allow the owner to perform or search.

Allow Group read.

Allow group writing.

Allow group execution or search.

Allow others to read.

Allow others to write data.

Allow others to perform or search.

Access Control: this program should be installed as a normal user program in the "trusted computing base.

Only the file owner or user can change the file mode.

This command returns the following export value:

The command has been successfully executed and all request changes have been executed.

An error occurred.

Contains commands.

Related Article

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.