服务器之间免密登陆
## 服务器之间免密登陆
例:A服务器免密登陆B服务器
1.在A服务器生成公钥私钥:ssh-keygen
如果已经存在则跳过此步骤查询目录:cd .ssh/
2.将A服务器的公钥复制到B服务器的authorized_keys中:ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host
此命名需要输入B服务器的root账户密码
如果忘记root账户密码,直接手动将A服务器的公钥id_rsa.pub复制到B服务器的authorized_keys中
3.免密登陆校验:ssh remote-host
补充:known_hosts文件
764
0
0
1年前