ssh登录使用2个一样的私钥,一个能登录,一个不能登录是什么鬼!

Web、Mail、Ftp、DNS、Proxy、VPN、Samba、LDAP 等基础网络服务
回复
头像
langyxxl
帖子: 443
注册时间: 2012-01-17 22:17

ssh登录使用2个一样的私钥,一个能登录,一个不能登录是什么鬼!

#1

帖子 langyxxl » 2015-12-15 18:43

zs@zs-X250:~/Documents/github/neutron-liberty$ md5sum ~/.ssh/id_rsa ~/.ssh/id_rsa.bak
d76336e3d0c297778ab9c79a40c09ab3 /home/zs/.ssh/id_rsa
d76336e3d0c297778ab9c79a40c09ab3 /home/zs/.ssh/id_rsa.bak
zs@zs-X250:~/Documents/github/neutron-liberty$ ll ~/.ssh/id_rsa ~/.ssh/id_rsa.bak
-rw------- 1 zs zs 1675 12月 15 16:34 /home/zs/.ssh/id_rsa
-rw------- 1 zs zs 1675 12月 15 18:29 /home/zs/.ssh/id_rsa.bak

zs@zs-X250:~/Documents/github/neutron-liberty$ ssh root@10.89.153.51 -i ~/.ssh/id_rsa
root@10.89.153.51's password:

zs@zs-X250:~/Documents/github/neutron-liberty$ ssh root@10.89.153.51 -i ~/.ssh/id_rsa.bak
Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-32-generic x86_64)

* Documentation: https://help.ubuntu.com/

有人在ubuntu15.10里面遇到这个问题吗?感觉完全无从下手啊 :Cry
头像
lainme
论坛版主
帖子: 7805
注册时间: 2008-09-13 19:17
系统: Arch Linux (x86_64)
联系:

Re: ssh登录使用2个一样的私钥,一个能登录,一个不能登录是什么鬼!

#2

帖子 lainme » 2015-12-15 19:41

加-vvv试一下
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: ssh登录使用2个一样的私钥,一个能登录,一个不能登录是什么鬼!

#3

帖子 poloshiao » 2015-12-15 20:51

sudo cat /etc/ssh/ssh_config | grep IdentityFile
头像
langyxxl
帖子: 443
注册时间: 2012-01-17 22:17

Re: ssh登录使用2个一样的私钥,一个能登录,一个不能登录是什么鬼!

#4

帖子 langyxxl » 2015-12-16 8:47

@poloshiao
我今天打开电脑,发现这2个私钥都能用来登录了,不知道为什么。。。
感觉好神奇啊。以后出了问题先重启电脑试试
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: ssh登录使用2个一样的私钥,一个能登录,一个不能登录是什么鬼!

#5

帖子 poloshiao » 2015-12-16 9:51

发现这2个私钥都能用来登录了
看看
sudo cat /etc/ssh/ssh_config | grep IdentityFile
這是你執行 ssh 指令時
在 client 端 用來確認執行者身份 使用的檔案
ssh root@10.89.153.51 -i ~/.ssh/id_rsa
ssh root@10.89.153.51 -i ~/.ssh/id_rsa.bak
詳細參見
http://manpages.ubuntu.com/manpages/viv ... ssh.1.html
ssh — OpenSSH SSH client (remote login program)
-i identity_file
Selects a file from which the identity (private key) for public
key authentication is read. The default is ~/.ssh/identity for
protocol version 1, and ~/.ssh/id_dsa, ~/.ssh/id_ecdsa,
~/.ssh/id_ed25519 and ~/.ssh/id_rsa for protocol version 2.
Identity files may also be specified on a per-host basis in the
configuration file. It is possible to have multiple -i options
(and multiple identities specified in configuration files). ssh
will also try to load certificate information from the filename
obtained by appending -cert.pub to identity filenames.
multiple identities 是允許許多身份確認的檔案存在
意思是 只有 ~/.ssh/id_rsa 或 ~/.ssh/id_rsa.bak 是唯一存在的有效確認身份的檔案
否則 下結論說 是 ~/.ssh/id_rsa 或 ~/.ssh/id_rsa.bak 的功勞 考能需要查證
回复