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

概述

首先,说实在的,这个已经被很多人说过了,但是,我是第一次用,没错,我就是这么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.

之后你就可以免密登录了

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

猜你喜欢

转载自my.oschina.net/u/3778921/blog/1802307
今日推荐