Create SSH User Equivalence Between 2 Servers Linux
Lets say you have 2 servers : server1, server 2 and you need to configure password-less login between both the servers.
- Login to Server 1 and identify the .ssh directory exists under the home directory
Incase it doesnt exist you can create it
cd /root mkdir .ssh chmod 700 .ssh
On Linux for root user it is normally /root/.ssh
$ cd /root/.ssh $ ssh-keygen -t rsa
This will create 2 files id_rsa and id_rsa.pub. One is a private key file and other is the public key file.
$ cat id_rsa.pub >> authorized_keys
Now copy this file to the server 2 using scp utility
$ scp authorized_keys root@server2:/root/.ssh
- Now on Server 2 identify the .ssh directory which should ideally be on the same location /root/.ssh
$ cd /root/.ssh $ ssh-keygen - rsa
This will again create the public and private keyfile
$ cat id_rsa.pub >> authorized_keys
Now scope this file back to Server 1
$ scp authorized_keys root@server1:/root/.ssh
Now try top ssh between the nodes
From Server 1
ssh root@server2
From Server 2
ssh root@server1
One comment
Quite useful article, Thanks for your effort.