Detailed explanation of Linux file permissions

Guanhui
Release: 2020-05-29 17:20:58
Original
3985 people have browsed it

Detailed explanation of Linux file permissions

Linux file permissions detailed explanation

Linux system has very strict control over file permissions. If the operator performs a certain Each operation must have the corresponding operation permissions to be executed successfully. The permission types generally include read, write, and execute, and the corresponding letters are r, w, and x.

If we want to represent all the permission details of a file, there are two ways:

1. Ten-digit binary representation, (each of the three attribute groups uses binary digits, plus one The highest digit (ten digits in total) can be simplified to a three-digit octal form

2. A twelve-digit binary representation (twelve binary digits) can be simplified to a four-digit octal form

Ten-digit permission representation

Common permission representation forms are:

-rw------- (600) Only the owner has read and write permissions.

-rw-r--r-- (644) Only the owner has read and write permissions; users belonging to the group and other users only have read permissions.

-rwx------ (700) Only the owner has read, write, and execute permissions.

-rwxr-xr-x (755) The owner has read, write, and execute permissions; while group users and other users only have read and execute permissions.

-rwx--x--x (711) The owner has read, write, and execute permissions; while group users and other users only have execution permissions.

-rw-rw-rw- (666) All users have file read and write permissions.

-rwxrwxrwx (777) All users have read, write, and execute permissions.

Analysis of the last nine digits: Linux permissions have a total of three groups. Each group uses three positions to define three types of operation (read, write, execute) permissions. Together they are the last nine digits of the permissions. . The characters above represent permissions, where - represents no permission, r represents read permission, w represents write permission, and x represents execution permission.

In fact, the meaning of each position of the last nine digits (representing a certain permission of a certain group) is fixed. If the permissions of each position are replaced by binary numbers 1 and 0, then Read-only, write-only, and execute-only permissions can be expressed as three-digit binary numbers as

r-- = 100

#-w- = 010

--x = 001

--- = 000

Explanation about the first and highest digit: The above mentioned the meaning of the last nine digits in the permission representation, and the remaining first digit represents the file. Type, the type can be one of the following:

d represents directory (directroy)

- represents file (regular file)

s represents It is a socket file (socket)

p represents a pipe file (pipe) or a named pipe file (named pipe)

l represents a symbolic link file (symbolic link)

b represents that the file is a block-oriented device file (block-oriented device file)

c represents that the file is a character-oriented device file (charcter-oriented device file)

Recommended tutorial: "Linux Operation and Maintenance"

The above is the detailed content of Detailed explanation of Linux file permissions. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!