Linux 修改文件执行权限
Linux chmod About 1,504 wordschmod 帮助文档
chmod --help
Usage: chmod [OPTION]... MODE[,MODE]... FILE...
  or:  chmod [OPTION]... OCTAL-MODE FILE...
  or:  chmod [OPTION]... --reference=RFILE FILE...
Change the mode of each FILE to MODE.
  -c, --changes           like verbose but report only when a change is made
      --no-preserve-root  do not treat `/' specially (the default)
      --preserve-root     fail to operate recursively on `/'
  -f, --silent, --quiet   suppress most error messages
  -v, --verbose           output a diagnostic for every file processed
      --reference=RFILE   use RFILE's mode instead of MODE values
  -R, --recursive         change files and directories recursively
      --help     display this help and exit
      --version  output version information and exit
Each MODE is of the form `[ugoa]*([-+=]([rwxXst]*|[ugo]))+'.
Report chmod bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'chmod invocation'
| 符号 | 解释 | 
|---|---|
| + | 添加权限 | 
| - | 去除权限 | 
| = | 设置成相应权限 | 
| a | all:所有用户 | 
| u | user:当前用户 | 
| o | other:其他用户 | 
| r | read:读权限 | 
| w | write:写权限 | 
| x | excute:执行权限 | 
示例
- 给所有用户添加
test.sh文件可执行权限,注意:+-=操作w权限时只给当前用户添加 
chmod +x test.sh
- 等同与
+x,给所有用户添加test.sh文件可执行权限 
chmod a+x test.sh
- 给当前用户添加
test.sh文件的可执行权限 
chmod u+x test.sh
- 给
other用户添加test.sh文件的可执行权限 
chmod o+x test.sh
- 去除所有用户对
tesh.sh文件的写和执行权限 
chmod a-wx test.sh
- 给所用用户添加
test.sh文件的可读可写可执行权限 
chmod a=rwx test.sh
                Views: 4,114 · Posted: 2019-08-07
            
            ————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
        Loading...