# Linux 文件权限

[\
![Linux 文件权限](https://morvanzhou.github.io/static/results/linux-basic/03-01-02.png)](https://morvanzhou.github.io/static/results/linux-basic/03-01-02.png)

* **Type**: 很多种 (最常见的&#x662F;**-**&#x4E3A;文件,d为文件夹)
* **User**: 后面跟着的三个空是使用 User 的身份能对这个做什么处理(r能读;w能写;x能执行;-不能完成某个操作).
* **Group**\
  : 一个 **Group** 里可能有一个或多个 **user**, 这些权限的样式和 **User** 一样.
* **Other**\
  : 除了 **User** 和 **Group** 以外人的权限.

## chmod 修改权限

通常的修改形式是

```python
$ chmod [谁][怎么修改] [哪个文件]
```

```python
$ ls -l t1.py
-r--rw-r-- 1 morvan morvan 34 Oct 12 09:51 t1.py
```

\[谁]

* **u**

  : 对于 **User**修改
* **g**

  : 对于 **Group** 修改
* **o**

  : 对于 **Others** 修改
* **a**

  : **(all)** 对于所有人修改

\[怎么修改]

* **+,-,=**: 作用的形式, 加上, 减掉, 等于某些权限
* **r,w,x**或者多个权限一起, 比如**rx**

\[哪个文件]

* 施加操作的文件, 可以为多个

```python
-rw----r-- 1 morvan morvan 80 Oct 12 09:57 t2.py
-rw-rw-r-- 1 morvan morvan 12 Oct 12 09:56 t3
-rwxrw-r-- 1 morvan morvan 55 Oct 13 17:28 t.py

$ chmod u-r t2.py
$ ls -l t2.py
--w----r-- 1 morvan morvan 80 Oct 12 09:57 t2.py

$ chmod g+x-w t3
$ ls -l t3
--w-r-xr-- 1 morvan morvan 12 Oct 12 09:56 t3
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://baozoulin.gitbook.io/linux/linux-wen-jian-quan-xian.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
