日期:2014-05-16  浏览次数:22972 次

使用chown命令,提示Operation not permitted
在linux终端输入命令/usr/sbin/chown -R "user:staff" /Users/user/Documents/test
提示:
chown: /Users/user/Documents/test/test.txt: Operation not permitted

test下面的文件都提示Operation not permitted。
我登录的用户是系统管理员用户user,usr/sbin/chown 这个目录也存在。
可是为什么会Operation not permitted呢。而其它人的机器上执行,却一切正常。比较了好多权限,都一样。
求解。
------解决方案--------------------
root 才能 chown 试试 sudo chown

POSIX

Unless chown is invoked by a process with appropriate privileges, the set-user-ID and set-group-ID bits of a regular file will be cleared upon successful completion; the set-user-ID and set-group-ID bits of other file types may be cleared. 

BSD
     The ownership of a file may only be altered by a super-user for obvious
     security reasons.

------解决方案--------------------
你是想把用户user的用户组改为staff吗?
命令:
usermod -g staff user
使用root 执行上述命令

------解决方案--------------------
必须以root执行
which usermod
echo $?
看看返回值
------解决方案--------------------
那说明没有这个命令,或者非root用户看不到这个命令。
建议你还是以root登录再查查这个命令
------解决方案--------------------
你可以按Ctrl+Alt+Del重启,到引导的时候,选择Grub的启动项,按e修改,在linux那行最后加一个“ single”(没有引号),然后按F10启动,就可以不用密码进入root身份,也可以修改root密码。不过某些发行版由于安全的考虑,默认禁用了这个功能。
那你就只能试试Rescue CD了。