This topic describes the process for
disabling
password authentication in the sshd_config file and enabling
private/public key authentication to
ensure that private and public key authentication is enabled for your SSH server.
-
Open your SSH server configuration file in a text editor.
The configuration file is located in the following directory:
# /etc/ssh/sshd_config
-
Ensure that PubkeyAuthentication yes has been added or
uncommented, and that PasswordAuthentication yes has been
commented out with a #.
The section should look like the following:
...
PubkeyAuthentication yes
#PasswordAuthentication yes
PasswordAuthentication no
...
-
You must restart or reload the SSH server to apply your new settings.
Restarting or reloading your SSH server does not impact currently connected
users.
To restart or reload your SSH server, use the following commands:
OS Version |
Instructions |
RedHat (restart) |
$ sudo service sshd restart
|
RedHat (reload) |
$ sudo service sshd reload
|
Debian (restart) |
$ sudo /etc/init.d/ssh restart
|
Debian (reload) |
$ sudo /etc/init.d/ssh reload
|
Private and public key authentication should now be enabled for your SSH server.