配置多台主机免密码登录操作过程
1.生成密钥
#@1号机上
ssh-keygen -t rsa
2.修改配置文件
vim /etc/ssh/sshd_config
######################
PasswordAuthentication no #关闭密码登录
######################
3.挂锁
cd /root/.ssh
cp id_rsa.pub authorized_keys
4.下载钥匙
sz id_rsa #非常重要
5.重启服务
systemctl restart sshd
6.使用密钥登录
7.复制密钥文件到其他主机
scp -r /root/.ssh @2号机IP:/root
8.登录2号机
ssh @2号机IP
9.修改配置文件
vim /etc/ssh/sshd_config
######################
PasswordAuthentication no #关闭密码登录
######################
10.重启服务
systemctl restart sshd
11.使用密钥登录2号机