一、生成一个密钥

~]# ssh-keygen -t rsa 


一直回车即可,也可以为key加密。

二、复制公钥到目标主机

~]# ssh-copy-id -i  ~/.ssh/id_rsa.pub root@172.16.10.20


此时当前主机可以直接基于密钥连接172.16.10.20

~]#  ssh root@172.16.10.20

END
Last modification:October 19th, 2019 at 03:16 pm
If you think my article is useful to you, please feel free to appreciate