tldr/pages.zh/common/chmod.md

37 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.

# chmod
> 修改文件或目录的访问权限。
> 更多信息:<https://www.gnu.org/software/coreutils/chmod>.
- 授予所有者u执行x文件的权限
`chmod u+x {{文件}}`
- 授予所有者ur和写w文件或目录的权限
`chmod u+rw {{文件或目录}}`
- 移除用户组g的文件执行x权限
`chmod g-x {{文件}}`
- 授予所有用户ar以及执行x文件的权限
`chmod a+rx {{文件}}`
- 授予其他用户o不在所有者用户组和用户组g同样的权限
`chmod o=g {{文件}}`
- 移除其他用户o的所有权限
`chmod o= {{文件}}`
- 递归授予用户组g和其他用户o目录下所有文件和子目录的写w权限
`chmod -R g+w,o+w {{目录}}`
- 递归授予所有用户a目录下文件的读r权限和子目录的执行X权限
`chmod -R a+rX {{目录}}`