SSH的对等平等配置

假设有 2 linux 服务器 nodeA 和 nodeB, 它们都在同一个子网中.

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:

它的 – 用户

mkdir ~/.ssh

chmod 700 ~/.ssh/

ssh-keygen -t rsa

ssh-keygen -t dsa

nodeB:

它的 – 用户

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 commandssh-copy

ssh-copy-id user@server ssh-copy-id -i ~/.ssh/id_rsa.pubuser@remote_ip -p port


发表评论