How to disable password authentication in SSH

SSH is by default configured to allow password login. You can disable password authentication if you're in favour of public key authentication by following these steps;

  1. Set PasswordAuthentication to no in /etc/ssh/sshd_config
    PasswordAuthentication no
  2. Reload or restart SSH