Bboysoul's Blog

首页 公告 RSS

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

April 27, 2018 本文有 192 个字 需要花费 1 分钟阅读

概述

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

操作

首先生成一个rsa秘钥
ssh-keygen -t rsa
之后把这个秘钥拷贝到远程主机上,用下面这个命令就够了
ssh-copy-id [email protected]

➜  ~ ssh-copy-id [email protected]
/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
[email protected]'s password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh '[email protected]'"
and check to make sure that only the key(s) you wanted were added.

之后你就可以免密登录了

欢迎关注我的博客www.bboy.app
Have Fun


Tags:

本站总访问量 本站总访客数