keychain实现ssh对秘钥免登陆免输入密码

  Linux同一网段实现密码认证,管理。

项目:https://github.com/funtoo/keychain

01、生成秘钥

ssh-keygen -t rsa   #  -t rsa | dsa
123123  --key认证密码

 02、拷贝公钥到客户端上

ssh-copy-id  -i /root/.ssh/id_rsa.pub   root@ip

 cat id-rsa.pub >>~/.ssh/authorized_keys    #追加公钥

 chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys   #权限设置

 03、编译keychain

https://github.com/funtoo/keychain

make

cp keychain /usr/bin/

注意:keychain,在控制端,也就是私钥存储的服务器上!

04、配置本地用户变量

vim ~.bash_profile

keychain id_rsa
. ~/.keychain/$HOSTNAME-sh

source  ~.bash_profile

05、远程ssh客户端

ssh root@ip    #第一次,需要输入秘钥的密码(目的为了防止私钥泄露还能有密码保护)

后续登录,不在会提示输入秘钥密码(除非机器重启)

下载地址:

http://pan.baidu.com/s/1cnjCwm 密码: ebhp

原文地址:https://www.cnblogs.com/xiaochina/p/7364893.html