Wasted lot of time today trying to figure out why ssh on some server still allows to log in with password despite the fact that in /etc/ssh/sshd_config password based log in is disabled:
PasswordAuthentication no
Since the configuration is managed by Puppet I was expecting it restarts service as well. To my surprise pid file of sshd process was pretty old - Puppet, in fact, was unable to restart sshd:
# puppet agent --debug --test
...
Error: Could not start Service[sshd]: Execution of '/etc/init.d/ssh start' returned 1:
Error: /Stage[main]/Sshd/Service[sshd]/ensure: change from stopped to running failed: Could not start Service[sshd]: Execution of '/etc/init.d/ssh start' returned 1:
...
It appears that Puppet tried to use init.d script. I’ve found a bug submitted to launchpad - init.d ssh script is broken in Ubuntu 14.04.
# dpkg -l | grep openssh-server
ii openssh-server 1:6.6p1-2ubuntu2 amd64 secure shell (SSH) server, for secure access from remote machines
Please be informed and use ‘service’ command instead:
# service ssh restart