Print this page

How to configure Keyless SSH between two servers


Being asked for password every time sometimes proves to be an overhead as you have to wait for the server to ask and authenticate password. Since scripting is very important for system admins so for that purpose we have to have keyless SSH between servers for this purpose 

In this post we will suppose two servers named as Server A and Server B and we will see how we can configure Keyless SSH from Server A to Server B

On Server A:

We have to generate SSH key on the source server A by following command

# ssh-keygen -t rsa

Just press Enter on all the options it asks you so that key is generated

Now goto the file where public key is generated 

#vi /root/.ssh/id_rsa.pub

Copy the key which will be like follows 

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDO37diuePAmPiLxYuwBIPiTqDc4BXF+IIe7nIVZLqhiR0ay/WASPdGtxkXs/u1WLDIgrKMxbUSnjvkHS1I+wfOtqoAZvKO4/kvTdi8Rw/YKsBJMbiefaEQXAbhBO7uUgn0s5mmz7dvCKcDb09cWW2Sz7YwLbeICZ4R0tbo4rWE6yFnpUCaui6g7QkIatW1F9FE8ohne3gokGAFARslV9KWjpuCQUXMgm7tBfyFTihYB5oWXcK9f+U0BfodhbrXGv24Tf3i6h3W6MR7k7nXjtIIndwc4E6jfDkztIIC8rI49CiWHy2ifGyTAkLEYbao9hIYZusmI9Da570RHtxme0MP root@WiSIP

Now login to Server B:

Open the file

# vim /root/.ssh/authorized_keys

Paste the key of server A in this file 

Save and exit the file 

Congrats! You can successfully SSH from A to B without password. If you want to do this from B to A go through the same process in opposite way



Michael Dudli

Cloud Specialist with more than 10 years experience in the Hosting Business.

Website: www.cloudserver24.com
All rights reserved.