Linux 修改文件执行权限

Linux chmod About 1,504 words

chmod 帮助文档

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
GNU coreutils home page: <>
General help using GNU software: <>
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
  • 等同与+x,给所有用户添加test.sh文件可执行权限
chmod a+x
  • 给当前用户添加test.sh文件的可执行权限
chmod u+x
  • other用户添加test.sh文件的可执行权限
chmod o+x
  • 去除所有用户对tesh.sh文件的写和执行权限
chmod a-wx
  • 给所用用户添加test.sh文件的可读可写可执行权限
chmod a=rwx
Views: 3,173 · Posted: 2019-08-07

————        END        ————

Give me a Star, Thanks:)



Today On History
Browsing Refresh