Enabling RSA key-based authentication on UNIX and Linux operating systems
Well in one of my previous blog, I explained how to create the SSH Public / Private key pair. In todays session, I will be explaining you all how to Enable the authentication on Unix / Linux Server, based on these generated RSA key pair. You can use RSA key-based authentication as an alternative to simple password authentication.
- Enable key-based authentication in the '/etc/ssh' directory on the server.
Ensure that the following lines exist in the 'sshd_config' file:# Should we allow Identity (SSH version 1) authentication?
RSAAuthentication yes
# Should we allow Pubkey (SSH version 2) authentication?
PubkeyAuthentication yes
# Where do we look for authorized public keys?
# If it doesn't start with a slash, then it is
# relative to the user's home directory
AuthorizedKeysFile .ssh / authorized_keys
- Also, in the same 'sshd_config' file, add 'LogLevel DEBUG' in '# Logging' section. This would help you debug the errors in the default log file ' / var / log / auth.log'.
-
Now add the Public Key of yours into the 'authorized_keys' file of server located at '$HOME / .ssh / '.
$ vim .ssh / authorized_keys
Make a note, the public key should be in OpenSSH format and not SSH2. Refer https://tutorialinux.com/convert-ssh2-openssh/ to convert it if needed.
-
Finally, restart the SSH service with command :
$ sudo service sshd restart
Done ! ! We are all set to connect to Server based on our Public / Private Key pair and no need to rely on Password anymore.
Add new comment