我怎么可能无法通过rootsu root
或身份登录su
(出现错误的密码错误),但是却可以通过ssh root@localhost
或ssh root@my_local_IP
使用相同的密码登录?
我正在使用CentOS 6.4。
cat /etc/pam.d/su
给出:
#%PAM-1.0
auth sufficient pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
#auth sufficient pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
#auth required pam_wheel.so use_uid
auth include system-auth
account sufficient pam_succeed_if.so uid = 0 use_uid quiet
account include system-auth
password include system-auth
session include system-auth
session optional pam_xauth.so
$ sudo grep su /var/log/secure | grep -v sudo
给出:
Feb 23 13:12:17 fallah su: pam_unix(su:auth): authentication failure;
logname=fallah uid=501 euid=501 tty=pts/0 ruser=fallah rhost= user=root
重复约20次。
在您的评论中,您说/bin/su
具有以下模式/所有者:
-rwxrwxrwx. 1 root root 30092 Jun 22 2012 /bin/su
这里有两个问题。
它需要将set-uid位打开,以便它始终以root权限运行,否则,当普通(非root)用户运行它时,它将无法访问密码信息,/etc/shadow
也无法设置密码。userid所需的新用户。
它应该将group
andother
写位关闭,以便其他用户无法更改它。
要解决此问题,请登录为root
-您说可以使用ssh
-进行登录,然后键入
chmod 4755 /bin/su
或者,
chmod u+s,g-w,o-w /bin/su
(chmod的标准文档详细介绍了它所采用的参数类型。)这会将模式位恢复为首次安装操作系统时的方式。当您列出此文件时,它应如下所示:
-rwsr-xr-x. 1 root root 30092 Jun 22 2012 /bin/su
正如@ G-Man指出的那样,模式777的文件可能会被不受信任的用户覆盖,如果是这种情况,您可能希望从分发介质或备份中重新安装它们。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句