Peer-to-peer equality configuration of SSH

Suppose that there are 2 linux servers nodeA and nodeB, Both they are in same subnet.

we need to configure ssh peer-to-peer equality to meet the requirement of copying

a mass of files from nodeA to nodeB without password verification

nodeA:

su – user

mkdir ~/.ssh

chmod 700 ~/.ssh/

ssh-keygen -t rsa

ssh-keygen -t dsa

nodeB:

su – user

mkdir ~/.ssh

chmod 700 ~/.ssh/

ssh-keygen -t rsa

ssh-keygen -t dsa

nodeA:

cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys

cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys

ssh nodeB cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

ssh nodeB cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

scp ~/.ssh/authorized_keys nodeB:~/.ssh/authorized_keys

Then, login nodeA and nodeB through user. and login each other.

after this ,Peer-to-peer equality of ssh configuration will take effect.

Another way to copy public key from local to file

authorized_keys of remote server by command “ssh-copy”

ssh-copy-id user@server ssh-copy-id -i ~/.ssh/id_rsa.pub “user@remote_ip -p port”


Leave a Reply