computer_knowledge_notes/Software/文件管理/chmod.md

41 lines
953 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#### 简介
更改文件权限
#### 语法
```bash
chmod [OPTION] MODE FILE # 依据模式MODE来改变文件FILE的权限
chmod [OPTION] --reference=RFILE FILE # 依据写在文件RFILE里的模式来改变文件FILE的权限
```
#### 模式
```
# 一共有两种模式,数字模式和符号模式。
# 符号模式的形式是 [ugoa][+-=][rwxXst]
# u:所有者g:所属的组o:组外用户a所有用户
# +:增加权限, -:减少权限, =:指定权限
# rwx:读写执行s:设置用户和组ID不知道是什么鬼t:粘性位,只有属主可删除,其它人不可删除
# 数字形式
# 第一个数字4设置用户ID2设置组ID1设置
# 第二个数字用户权限4读2写1执行。
# 第三个数字属组权限4读2写1执行。
# 第四个数字其它用户权限4读2写1执行。
```
#### 选项
```
-R # 递归更改文件权限
```
#### 示例
```bash
```