我使用例如来改变每个人的权限:
chmod 777 file
现在,如果我想保留当前的权限呢?
我知道有这样的事情
chmod xx7 file
如果我只想改变世界的权限,但我不能解决(忘记)。
谢谢!
您可以将符号o用于他人,例如:
chmod o+rwx file
,
chmod o-rwx file
要么
chmod o+r file
您可以使用-撤销或+授予权限r , x , w或其任意组合。 同样,您可以为用户u或g组执行此操作。
哈立德的答案是最好的:学习使用符号。
如果你真的想要设置权限,你可以写一些脚本来获得权限的八进制格式,剥离最后一位数字并replace你自己的权限。
我想你可以写一些类似的bash脚本(注意:未经testing,没有inputvalidation):
#!/bin/bash otherperm=$1 filename=$2 newperm=`stat -c%a $filename |sed -e "s/.$/$otherperm/"` echo chmod ${newperm} ${filename}
但是,真的,学习在chmod中使用符号。