使用 ssh-keygen访问服务器

Posted 架构师易筋

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用 ssh-keygen访问服务器相关的知识,希望对你有一定的参考价值。

正常访问服务器192.168.0.1

ssh root@192.168.0.1
# waiting for input password
password

用ssh-keygen的方式
生成 ssh-keygen, 生成公钥~/.ssh/id_rsa.pu 和私钥 ~/.ssh/id_rsa root

ssh-keygen

接着上传公钥到服务器

ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.0.1
# waiting for input password
password

以后,直接访问下面的命令, 用私钥即可登录

ssh -i ~/.ssh/id_rsa root@192.168.0.1

更多请参考

https://www.ssh.com/academy/ssh/keygen

以上是关于使用 ssh-keygen访问服务器的主要内容,如果未能解决你的问题,请参考以下文章