CentOS7 set up SSH key-free login

CentOS7 set up SSH key-free login

1: The case has server A and server B. Now server A wants to log in to server B through SSH without key.

1 Configure ssh configuration file

vim /etc/ssh/sshd_config

PermitRootLogin yes
RSAAuthentication yes
PubkeyAuthentication yes 

Set the above three configurations to yes and restart the ssh service

#查看状态
systemctl status sshd.service
# 配置 ssh重启
systemctl enable sshd.service

2 Configure the key on server A

Insert picture description here

3 Copy the generated key to server B

ssh-copy-id -i ~/.ssh/id_rsa.pub root@服务器B的ip
#注意 -i 后面写的是密钥的绝对路径 不要写错

4 Login via ssh command

ssh 192.168.95.128  

Guess you like

Origin blog.csdn.net/dndndnnffj/article/details/109556753