Linux主机 ->多机器登录

step1:ssh-keygen(密钥生成)

step2:修改sshd_config 文件

vi /etc/ssh/sshd_config // 文件位置

把这行注释去掉

PubkeyAuthentication yes

AuthorizedKeysFile .ssh/authorized_keys

PasswordAuthentication no // 不能使用密码登录

service sshd restart

step3: 导入公钥

将第一步生成的公钥导入到需要使用的主机上

主机和备机都需要在authorized_keys 导入公钥

cd ~/.ssh/authorized_keys

echo '公钥' > authorized_keys

service sshd restart

step4: 开始使用

ssh root@要使用的主机名