CentOS7 设置SSH免密钥登陆
1 : 案例 有 服务器A和服务器B 现在 服务器A想要通过SSH免密钥登陆服务器B
1 配置ssh配置文件
vim /etc/ssh/sshd_config
PermitRootLogin yes
RSAAuthentication yes
PubkeyAuthentication yes
将以上三个配置设置为 yes 然后重启ssh服务
#查看状态
systemctl status sshd.service
# 配置 ssh重启
systemctl enable sshd.service
2 在服务器A配置密钥
3 将生成的密钥拷贝到服务器B
ssh-copy-id -i ~/.ssh/id_rsa.pub root@服务器B的ip
#注意 -i 后面写的是密钥的绝对路径 不要写错
4 通过 ssh命令进行登陆
ssh 192.168.95.128