介绍一个小技巧,如何实现ssh免密登录

《介绍一个小技巧,如何实现ssh免密登录》

概述

首先,说实在的,这个已经被很多人说过了,但是,我是第一次用,没错,我就是这么out

操作

首先生成一个rsa秘钥
ssh-keygen -t rsa
之后把这个秘钥拷贝到远程主机上,用下面这个命令就够了
ssh-copy-id root@vultr.bboysoul.com

➜  ~ ssh-copy-id root@vultr.bboysoul.com
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@vultr.bboysoul.com's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@vultr.bboysoul.com'"
and check to make sure that only the key(s) you wanted were added.

之后你就可以免密登录了

欢迎关注Bboysoul的博客www.bboysoul.com
Have Fun

    原文作者:bboysoul
    原文地址: https://www.jianshu.com/p/629d629be2a9
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞