现在的位置: 首页 > 综合 > 正文

[已解决]su 切换用户,提示:“密码不正确”;更改passwd权限后,又提示:“cannot set groups: Operation not permitted”

2017年12月14日 ⁄ 综合 ⁄ 共 545字 ⁄ 字号 评论关闭

今天在普通用户weil下,想切换到root。结果提示“密码不正确”

#su -

#密码:             @键入密码

#su: 密码不正确

重复试了几次,密码绝对没记错;然后试图切换到另一个普通用户kail下,同样提示“密码不正确”。


查看/etc下passw和shadow权限。

#ls -l /etc/{passwd,shadow}

-rw------- 1 root root 2434 03-05 19:52 /etc/passwd

-rw------- 1 root root 1700 03-06 09:49 /etc/shadow

发现普通用户没有读passwd文件的权限。然后修改passwd权限:

#chmod 644 /etc/passwd


在重新切换到root

#su -

#su: cannot set groups: Operation not permitted


上网搜索发现,错误原因是/bin/su文件被取消了s位,所以解决方法是
chmod a+s /bin/su

#ls -l /bin/su

-rwxr-xr-x 1 root root 39948 03-05 14:38 /bin/su

#chmod a+s /bin/su

#ls -l /bin/su

-rwsr-sr-x 1 root root 39948 03-05 14:38 /bin/su


再重新登录root,问题解决。


抱歉!评论已关闭.