Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Application of File permission in Linux

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Linux system has very strict control over the permissions of files. If the operator performs some operation on a file, he must have the corresponding operation authority to execute successfully. The types of permissions generally include read, write and execute, and the corresponding letters are r, w, x respectively.

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

1. Ten-bit binary representation (each of the three genera groups uses a binary bit, plus a total of ten bits), which can be simplified to a three-bit octal form

2. Twelve-bit binary representation (twelve binary bits), which can be simplified to four-bit octal form

Ten-digit permission representation

Common expressions of permissions are:

-rw- (600) only the owner has read and write access.

-rw-r--r-- (644) only the owner has read and write access, while group users and other users only have read access.

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

-rwxr-xr-x owners have read, write and execute permissions, while group users and other users only have read and execute permissions.

-rwx--x--x owners have read, write, and execute permissions, while group users and other users only have execute 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 subordinate groups, each using three locations to define three kinds of operation (read, write, execute) permissions, which together are the last nine digits of the permissions. Permissions are represented by characters above, where-represents no permission, r represents read permission, w represents write permission, and x represents execution permission.

In fact, the meaning of each location in the last nine digits (representing a permission belonging to a group) is fixed, and if the permissions of each location 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.

Rmurf-= 100

-w-= 010

-- x = 001

-= 000

Explanation of the first highest bit: the last nine digits in the permission representation are mentioned above, and the remaining first bit represents the type of the file, which can be one of the following:

D stands for directory (directroy)

-represents a file (regular file)

S stands for set file (socket)

Pipe file (pipe) or named pipe file (named pipe) represented by p

L stands for symbolic link file (symbolic link)

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

C represents a character-oriented device file (charcter-oriented device file).

The above are the details of the Linux file permissions, please pay more attention to other related articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report