Disable public key authentication in SSH

SSH in most system by default allow public key login. You can disable it with these simple steps if you somehow need to;

  1. Open SSHd configuration file with your default editor.
    $ sudo vim /etc/ssh/sshd_config
  2. Search and set PubkeyAuthentication option to no. Add the line if it doesn't already exist.
    PubkeyAuthentication no
  3. Reload or restart SSHd

Sign up for Complete Secure Shell Course and many other great courses on Udemy to learn more.

Written by Mohd Shakir Zakaria. Last updated on 2019-03-21