Linux修改文件权限

修改文件读写执行权限

rwx rwx rwx

分为三段,用户权限 用户组权限 其他人权限

r-r-r

添加权限

chmod +w test.txt     rw-r-r默认在用户权限下添加

chmod u+w/r/x test.txt   给用户添加权限

chmod g+w/r/x test.txt   给用户组添加权限

chmod o+w/r/x test.txt   给其他用户添加权限

 

chmod u-w/r/x test.txt  给用户减少权限

chmod g-w/r/x test.txt  给用户组减少权限

chmod o-w/r/x test.txt  给其他用户减少权限

 

chmod ug+w,o-w test.txt

 

chmod a+r test.txt 设为所有人皆可读取

chmod -R a+r file/ file文件及子文件设为所有人可读

 

chmod 777 test.txt 给test.txt添加所有权限

r=4 w=2 x=1

chmod 666 test.txt 所有用户添加读写权限

chmod 441 test.txt 用户读 用户组读 其他人执行

原文地址:https://www.cnblogs.com/EnzoDin/p/8336323.html