SSH key is a secure authentication method of openssh server. Let us install ssh key easily between two server.

Source Server:This is the server from which I need to connect.
Destination Server: This is the server into which I am going to connect.
Let us create ssh key for the root user in source server for accessing a backup user in destination server.

Create key in Source Server:

Do the following command as root

# ssh-keygen -t rsa

Now hit Enter key until you see the shell prompt again
So now we have two keys private and public in /root/.ssh . We only need the public key

Copy public key to Destination server:

Copy the content of public key,/root/.ssh/id_rsa.pub, from source server to the destination server into the files file ( /home/backupuser/.ssh/authorized_keys . This is for ssh user “backupuser”.
Testing:
Now try ssh from the Source server to destination server as follows,

# ssh  backupuser@destinationserver

If you are in without password , then the ssh-key configuration is success. If not, your ssh key is not working, check the error logs in /var/log/secure

Leave a Reply

Your email address will not be published. Required fields are marked *