配置多台主機免密碼登錄操作過程
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號機