Files
tldr/pages.zh_TW/common/chmod.md
2023-10-04 21:51:37 +05:30

38 lines
1.1 KiB
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
> 修改文件或目錄的存取權限。
> 使用者類型分為檔案所有者u、檔案所有者之群組g、以及其他使用者o
> 更多資訊:<https://www.gnu.org/software/coreutils/chmod>.
- 給予文件所有者執行的權限:
`chmod u+x {{檔案/完整/路徑}}`
- 給予使用者讀寫權利:
`chmod u+rw {{檔案/完整/路徑}}`
- 移除群組執行權限:
`chmod g-x {{檔案/完整/路徑}}`
- 給予全部使用者讀與執行權限:
`chmod a+rx {{檔案/完整/路徑}}`
- 給予其他使用者o和檔案所有者之群組g一樣的權限
`chmod o=g {{檔案/完整/路徑}}`
- 移除其他使用者o的全部權限
`chmod o= {{檔案/完整/路徑}}`
- 改變目錄底下所有檔案以及目錄的權限,給予檔案所有者之群組寫的權限,以及其他使用者寫的權限:
`chmod -R g+w,o+w {{目標目錄}}`
- 改變目錄底下所有檔案以及目錄的權限,給予全部使用者讀與對其底下檔案之執行權限:
`chmod -R a+rX {{目標目錄}}`