SSH server for most system is by default configured to allow public key authentication. This means that you can use your public and private key pair to log in to an SSH server.
You can disable SSH public key authentication on the server side if your private key has been has been compromised or for any other reason by configuring SSHd configuration file at the terminal.
Public key authentication method for SSH could be enabled or disabled by configuring sshd_config file on the server.
$ sudo vi /etc/ssh/sshd_config [sudo] password for user:
PubkeyAuthentication no
Add the line if it doesn't already exist and remove the # at the beginning of the line if exists.
Set it to yes to allow public key authentication method and no to disallow.
Make sure your other authentication method such as via password is enabled before disabling public key authentication method as you might completely lose remote access to your server.
$ sudo systemctl restart sshd
Guide compatibility:
Operating System |
---|
Ubuntu Linux |
Debian Linux |
Red Hat Enterprise Linux |
Fedora Linux |
CentOS Linux |
openSUSE Linux |
SUSE Linux Enterprise Server |
FreeBSD |
OpenBSD |
NetBSD |
macOS |
Comment anonymously. Login not required.