Modification of file access permissions in Unix operating systems

Source: Internet
Author: User
Article Title: Modification of file access permissions in Unix operating systems. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

In a Unix operating system, you can use the chmod command to modify the file access permission. The format of the chmod command is as follows:

 Format 1: chmod symbolic_mode file...

Format 2: chmod absolute_mode file...

Format 1: symbolic_mode. The command format of the symbolic mode is as follows:

Chmod [who] op permision file...

The who item indicates the user type, and its content is one or more of the following:

U file owner)

G User group)

O others (other)

A all)

Op indicates action:

+ Indicates adding the permission specified by permission.

-Cancels the permission specified by permission.

A permission item is an access permission with one or more of the following content:

R indicates readable

W indicates writable

X indicates executable

Example:

The chmod u + w test report owner is "writable" to the test and report files"

The chmod u-x abc. c owner cannot execute the abc. c file.

Chmod u + rwx myfile1 owner for myfile1 "readable, writable, and executable"

Chmod ugo + rwx myfile2 anyone on myfile1 "readable, writable, and executable"

Format 2: absolute mode (absolute_mode). The command format of symbolic mode is as follows:

Chmod xyz file...

X, y, and z are numbers 0-7 respectively, indicating the access permissions of the owner, user group, and others to the file. The values of x, y, and z are:

A * 4 + B * 2 + c

Where,

A = 1 indicates readable, and a = 0 indicates unreadable;

B = 1 indicates writable, and B = 0 indicates non-writable;

C = 1 indicates executable, and c = 0 indicates not executable;

Example:

Chmod 751 ncp owners have all the rights to "read, write, and execute" to ncp; members in the group have only the "readable and executable" rights to ncp; other users have only "executable" rights to ncp.

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.