centos7 秘钥登录

2020-05-14 11:08:32   工作备份

 

  1. #使用想登陆的用户执行
  2. ssh-keygen -t rsa
  3. cd /root/.ssh/
  4. cat id_rsa.pub >> authorized_keys
  5. vim /etc/ssh/sshd_config
  6. ···
  7. #修改为yes
  8. PubkeyAuthentication yes
  9. #禁用密码登录(测试成功后修改)
  10. PasswordAuthentication no
  11. ···
  12. systemctl restart sshd

下载id_rsa私钥,本地使用即可