Chmod-change the access mode of one or more files)

Source: Internet
Author: User

Chmod-change the access mode of one or more files)


Chmod [Options] mode files


Only file owners or privileged users can use this function to change the file access mode. Mode can be in the digital format or in the WHO opcode permission format. Which is optional. The default value is a (all users ). Only one opcode can be selected ). You can specify multiple modes separated by commas.


Options:


-C, -- Changes

Only output the information of the changed File


-F, -- silent, -- quiet

When the CHMOD mode cannot be changed, the file user is not notified.


-- Help

Output help information.


-R, -- Recursive

Recursively traverse sub-directories and apply modifications to all files and sub-directories in the directory


-- Reference = filename

Set the permission by referring to the filename permission.


-V, -- verbose

Whether the modification is successful or not, the information of each file is output.


-- Version

Output version information.


Who


U

User


G

Group


O

Others


A

All users (default)


Opcode


+

Add Permissions


-

Delete permission


=

Reassign Permissions


Permission


R

Read


W

Write


X

Run


S

Set the ID of a user (or group)


T

Sets Sticky Bit to prevent files or directories from being deleted by non-owners.


U

Current User Permissions


G

Current permissions of the Group


O

Current permissions of other users


In most cases, we use three Octal numbers to indicate permissions. The first one is the owner permission, the second is the group permission, and the third is the permission of other users, each permission is determined by the sum of four (read), two (write), and one (execution) values. For example, 6 (4 + 2) indicates that you have the read and write permissions, and 7 (4 + 2 + 1) indicates that you have the read, write, and execution permissions.


You can also set the fourth digit, which is located before the three-digit permission sequence. The fourth digit is 4, 2, and 1, which means the following:


4. Set the user ID during execution to authorize the process based on the file owner, instead of the user who creates the process.


2. Set the user group ID during execution to authorize the process based on the file group, instead of the user who creates the process.


1. Set the adhesion position.


Instance:


$ Chmod U + X file: add the execution permission to the file owner.

$ Chmod 751 the file owner is assigned the read, write, and execute permissions (7) to the file owner, and the read and execute permissions (5) to the file group, assign execution (1) permissions to other users

$ Chmod u = rwx, G = RX, O = X file

$ Chmod = r file: Assign read permissions to all users

$ Chmod 444 file: Same as above

$ Chmod A-WX, A + R file is the same as above.

$ Chmod-r u + r directory recursively assign read permissions to the owner of all files and subdirectories in the directory

$ Chmod 4755 sets the ID to assign read, write, and execute permissions to the owner, and assign read and execute permissions to the group and other users.


This article is from the "ghost" blog, please be sure to keep this source http://caizi.blog.51cto.com/5234706/1535882

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.