配置方法,做个小记录

server 上要配置允许

用户电脑

在 .ssh/config 文件中

Host *
 AddKeysToAgent yes
 UseKeychain yes
 IdentityFile ~/.ssh/id_rsa

Host xxx
  HostName xx.xx.xx.xx
  User jerry

把pub key传到server

ssh-copy-id -i ~/.ssh/id_rsa.pub xx@xx.xx.xx.x

可以了