Passwordless SSH on CentOS

The CentOS wiki page misses out a crucial step in setting up passwordless SSH.

Whilst the wiki provides most of the information required to set up passwordless SSH on CentOS, namely:

  • Creating SSH keys
  • Setting key permissions correctly
  • Ensuring correct SELinux contexts
  • Setting “PasswordAuthentication no” in /etc/ssh/sshd_config

If there is a problem with the key then this setup will still go ahead and ask for a password when trying to connect via SSH. Which is probably not what you want if you are trying to turn off password authentication. To resolve this you must again edit /etc/ssh/sshd_config and set:

ChallengeResponseAuthentication no

By default it is set to ‘yes’ (this is an interesting difference between CentOS and Ubuntu).

Don’t forget to restart the SSH service after making changes otherwise they won’t be updated:

sudo service sshd restart
This entry was posted in Linux. Bookmark the permalink.

Leave a Reply

Your email address will not be published.