chmod common usage

Source: Internet
Author: User

1 features

Change the access rights of the file. Mainly read, write, execute permissions.

2 Description 2.1 Types of permissions

R Read

W Write

X execute (or access to the directory)

x Append x attribute only if the target file is executable to some users or the target file is a directory

s set user or group ID at the same time

t sticky bit (delete or move)

2.2 Digital Permissions

Permissions can be replaced by four-bit octal digits, which are represented by:

First: 4 is suid, the file runs as the owner, 2 is Sgid, only the directory is set, the newly created file in the directory has the default setting of suid;1 as the sticky bit, which is understood as delete permission.

Second bit: Set permissions for the file owner.

Third bit: Set permissions for the group where the file owner resides.

Fourth bit: Set permissions for other group users.

2.3 Permission Objects

The owner of the U file

G users in the same group as the file owner

o Other groups of users

A All Users =ugo

2.4 operator

+ Add Permissions

-Delete Permissions

3 Common usage 3.1 Add File execution permissions to yourself

chmod u+x File

The difference from chmod file is that the latter clears other permissions, in addition to the EXECUTE permission.

3.2 Adding directories (and subdirectories) to everyone access permissions

Chmod-r +r File

3.3 Clear All permissions


Equivalent to chmod file

chmod common usage

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: 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.