Linux: file permission

Time:2021-1-17

1、 Interpretation of document authority

In Linux, files have three kinds of permissions, which are;

1. W: writable

2. R: readable
3. X: executable

These three characters are respectively placed in the command line where we view the file details. At the same time, when we view the details of the file, the first character is not w / R / x, but D / L / -, where:

d: Indicates that this is a directory

l: Indicates that this is a shortcut (soft connection)

-: indicates that this is a file

We can use the LS – L / folder command to view the file properties in the home directory, as follows:

 

You can see that there are ten characters representing the read-write permission of the file. The first character is the D / L / -, which has just been mentioned. There are nine characters left, so what’s the meaning of these nine characters?

R — W — R –, we can divide it into the form of 3 * 3, that isr – – | w – – | r – –The permission of the first group means self, the second group is the same, and then others(Self | group | others)Separate permissions. So how do we modify the file permissions?

2、 Modify file permissions

Generally speaking, we can modify the permissions of (everyone / ourselves / others) in a file. Use the command Chmod to modify permissions, which means change and modify. Everyone is represented by a, u for user, and O for others. Adding readable permissions to yourself is U + W, and reducing readable permissions to yourself is u-w. Suppose we want to add the readability permission to the other person of the exam file, then we can enter the following command:

chmod o+w exam

In this way, we can see that exam has all the read and write permissions, as follows:

 

Recommended Today

Go carbon version 1.2.0 has been released to improve and optimize the multi scenario support for orm

Carbon is a lightweight, semantic and developer friendly golang time processing library, which supports chain call, lunar calendar, Gorm, xorm and other mainstream orm If you think it’s good, please give it to a star github:github.com/golang-module/carbon gitee:gitee.com/go-package/carbon Installation and use //Using GitHub Library go get -u github.com/golang-module/carbon import ( “github.com/golang-module/carbon”) //Using gitee Library go get […]