error: Could not get shadow information for root

Recently created rpm package from OpenSSH 6.7 tar ball package. After successfully creating rpm and upgrading the OpenSSH server, met with issue – error: Could not get shadow information for root .
Given below is some section of the error found in messages log (/var/log/messages)

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

NOTE: The problem found in CentOS 7.

The issue was coming due to use to user’s password which we have set in system. Here, we were using root user and password should be checked from shadow file. Hence, the pam file (/etc/pam.d/sshd) also play role here.

The conclusion is enable the UsePAM parameter in sshd_config.

Now we will enable the UsePAM parameter in /etc/ssh/sshd_config file.
Search for keyword UsePAM in /etc/ssh/sshd_config and make it yes.

vi /etc/sshd/sshd_
..
UsePAM yes
..

Now restart the sshd service.

systemctl restart sshd

Try once again doing ssh from remote server. I hope the issue will be resolved. If still facing issue, check the /var/log/messages and /etc/ssh/secure log for more troubleshooting.

1 thought on “error: Could not get shadow information for root”

  1. I changed pam to yes according to what you said,but met with issue:sshd(1209): Failed password for user from ip port *** ssh2(/var/log/messages)

    centos-6.5 openssh-7.5

Comments are closed.