Disable login using public key in SSH



SSH in most system by default allow login using public key. While this is convenient, it is a security risk when unauthorized person manage to get the private key, especially when the key is not protected by any passphrase. The option to allow public key authentication is PubkeyAuthentication in the /etc/sshd_config configuration file. If it is not set, SSH daemon will allow public key authentication.

To disable it, add the following line (or change the option to no if the option already exist) in the configuration file;

PubkeyAuthentication no

To have the changes take effect, the SSH daemon need to reload the edited configuration file with the following command;

# /etc/init.d/ssh reload

In some Linux distribution, the command is as the following;

# /etc/init.d/sshd reload

 


Posted on 04.09.2008 and categorized under linux

Comment Form


  • ayaz: Thanks for the tip.
  • TrueColorTech: Awesome Tip, I have been wanting that option for a while now!
  • iGadget: If this would work, it'd be really nice. However, when I use the command described in your post, I get the following error (twice): Could not conne
  • Alan: fedora 10 is so cool and i have fedora 10 too!
  • Kyle: Forgot to swing back by here after finding version 5.1.3 available, posted about it here: http://yokohead.com/2009/01/google-gears-in-firefox-x64-for

Categories