Linux/Mac 免密登录Linux

  1. linu A 登录 linux B
[root@A ~]#ssh-keygen -t rsa
[root@A ~]#cd /root/.ssh/
[root@A ~]#ssh-copy-id  B
[root@A ~]#ssh B
  1. mac 登录linux
imac $ ssh-keygen -t rsa
imac $ cd /Users/ username /.ssh
imac $ scp id_rsa.pub linux_A:/root/.ssh/
imac $ vi config
Host linux_A
      HostName linux_A
      User root
      IdentityFile ~/.ssh/id_rsa
[root@A ~] cat /root/.ssh/id_rsa.pub authorized_keys

验证

imac $ ssh linux_A

你可能感兴趣的:(Linux/Mac 免密登录Linux)