SSH报错-error: Could not get shadow information for root

时间:2019-08-20 17:58:10  来源:igfitidea点击:

最近从openssh6.7tarball包创建了rpm包。在成功创建rpm并升级后,遇到问题- 错误:无法获取根的影子信息

安装OpenSSH服务器后报错:

# tail /var/log/messages

May 17 11:21:17 localhost systemd: Started SYSV: OpenSSH server daemon.
May 17 11:21:26 localhost sshd[6426]: Connection closed by 192.168.1.100 [preauth]
May 17 11:21:29 localhost sshd[6443]: error: Could not get shadow information for root
May 17 11:21:29 localhost sshd[6443]: Failed password for root from 192.168.1.100 port 51041 ssh2

问题是出再我们在系统中设置的用户密码。

这里,我们使用的是root用户,检查的密码来自shadow文件。
因此,pam文件(/etc/pam.d/sshd)在这里也起作用。

所以要在“sshd_config”中启用“UsePAM”参数。

编辑/etc/ssh/sshd_config文件,启用UsePAM

vi /etc/sshd/sshd_config
..
UsePAM yes
..

重新启动sshd服务

systemctl restart sshd