当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 7 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : ssh信任有问题
帖子发表于 : 2016-03-24 12:09 

注册: 2015-03-10 16:39
帖子: 6
系统: ubuntu14.04
送出感谢: 0 次
接收感谢: 0 次
2台主机
sdst103 sdst106

我现在已经把103的公钥发到106上了 ssh-copy-id的方式

现在在103上ssh106连进去还需要密码

但是如果先登陆106 然后再在103上ssh106 是可以无密码登陆的
106登陆断开后 和先前一样 进去还是需要密码

以下是ssh -vvv 调试日志
bfadmin@sdst103:~$ ssh -vvv sdst106
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to sdst106 [192.168.100.106] port 22.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/bfadmin/.ssh/id_rsa" as a RSA1 public key
debug1: identity file /home/bfadmin/.ssh/id_rsa type 1
debug1: identity file /home/bfadmin/.ssh/id_rsa-cert type -1
debug1: identity file /home/bfadmin/.ssh/id_dsa type -1
debug1: identity file /home/bfadmin/.ssh/id_dsa-cert type -1
debug1: identity file /home/bfadmin/.ssh/id_ecdsa type -1
debug1: identity file /home/bfadmin/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/bfadmin/.ssh/id_ed25519 type -1
debug1: identity file /home/bfadmin/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6 pat OpenSSH_6.6.1* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug3: load_hostkeys: loading entries for host "sdst106" from file "/home/bfadmin/.ssh/known_hosts"
debug3: load_hostkeys: found key type ECDSA in file /home/bfadmin/.ssh/known_hosts:20
debug3: load_hostkeys: loaded 1 keys
debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-dss-cert-v00@openssh.com,ssh-ed25519,ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ssh-ed25519
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_setup: setup hmac-md5-etm@openssh.com
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none
debug2: mac_setup: setup hmac-md5-etm@openssh.com
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 73:29:50:75:96:6b:61:8e:5d:12:4b:c7:b8:a7:86:0b
debug3: load_hostkeys: loading entries for host "sdst106" from file "/home/bfadmin/.ssh/known_hosts"
debug3: load_hostkeys: found key type ECDSA in file /home/bfadmin/.ssh/known_hosts:20
debug3: load_hostkeys: loaded 1 keys
debug3: load_hostkeys: loading entries for host "192.168.100.106" from file "/home/bfadmin/.ssh/known_hosts"
debug3: load_hostkeys: found key type ECDSA in file /home/bfadmin/.ssh/known_hosts:3
debug3: load_hostkeys: loaded 1 keys
debug1: Host 'sdst106' is known and matches the ECDSA host key.
debug1: Found key in /home/bfadmin/.ssh/known_hosts:20
debug1: ssh_ecdsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/bfadmin/.ssh/id_rsa (0x7fbf6814af60),
debug2: key: /home/bfadmin/.ssh/id_dsa ((nil)),
debug2: key: /home/bfadmin/.ssh/id_ecdsa ((nil)),
debug2: key: /home/bfadmin/.ssh/id_ed25519 ((nil)),
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/bfadmin/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/bfadmin/.ssh/id_dsa
debug3: no such identity: /home/bfadmin/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /home/bfadmin/.ssh/id_ecdsa
debug3: no such identity: /home/bfadmin/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /home/bfadmin/.ssh/id_ed25519
debug3: no such identity: /home/bfadmin/.ssh/id_ed25519: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
bfadmin@sdst106's password:



我实在没有办法了 :Cry


页首
 用户资料  
 
2 楼 
 文章标题 : Re: ssh信任有问题
帖子发表于 : 2016-03-24 13:05 

注册: 2015-03-10 16:39
帖子: 6
系统: ubuntu14.04
送出感谢: 0 次
接收感谢: 0 次
103服务端的
bfadmin@sdst103:~$ ls -al ~/.ssh/
total 60
drwx------ 2 bfadmin bfadmin 4096 Mar 24 10:27 .
drwx------ 6 bfadmin bfadmin 4096 Mar 24 12:03 ..
-rw------- 1 bfadmin bfadmin 402 Mar 22 13:14 authorized_keys
-rw------- 1 bfadmin bfadmin 1679 Mar 17 16:34 id_rsa
-rw-r--r-- 1 bfadmin bfadmin 402 Mar 17 16:34 id_rsa.pub
-rw-r--r-- 1 bfadmin bfadmin 5550 Mar 24 12:24 known_hosts


106客户端的
bfadmin@sdst106:~$ ls -al ~/.ssh/
total 32
drwx------ 2 bfadmin bfadmin 4096 Mar 24 10:28 .
drwx------ 6 bfadmin bfadmin 4096 Mar 24 11:37 ..
-rw------- 1 bfadmin bfadmin 402 Mar 24 10:28 authorized_keys
-rw-r--r-- 1 bfadmin bfadmin 666 Mar 24 09:56 known_hosts



sshd_config见附件 客户端和服务端是一模一样的配置
附件:
ssh.zip [2.32 KiB]
被下载 49 次


页首
 用户资料  
 
3 楼 
 文章标题 : Re: ssh信任有问题
帖子发表于 : 2016-03-24 13:16 
头像

注册: 2007-05-06 8:19
帖子: 7446
送出感谢: 0 次
接收感谢: 5
你说的密码,是哪个的密码,是“用户密码”还是”密钥的短语令牌”


页首
 用户资料  
 
4 楼 
 文章标题 : Re: ssh信任有问题
帖子发表于 : 2016-03-24 13:19 
头像

注册: 2011-03-20 13:12
帖子: 4522
地址: 山东省寿光县
系统: Debian
送出感谢: 105
接收感谢: 997
o枫叶o飘零 写道:
但是如果先登陆106

如何登陆?跑到106机器跟前登录?ssh 输密码登录?
是否有一边的家目录加密了?

参考 https://help.ubuntu.com/community/SSH/OpenSSH/Keys#Troubleshooting

还有一个 debug 的办法是在服务端加上 -d 运行 sshd
在服务端运行:
代码:
service ssh stop
/usr/sbin/sshd -d

然后到客户端尝试用密钥连接,看服务端的输出

参考 http://unix.stackexchange.com/a/55481


_________________
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户


页首
 用户资料  
 
5 楼 
 文章标题 : Re: ssh信任有问题
帖子发表于 : 2016-03-24 14:07 

注册: 2015-03-10 16:39
帖子: 6
系统: ubuntu14.04
送出感谢: 0 次
接收感谢: 0 次
vickycq 写道:
o枫叶o飘零 写道:
但是如果先登陆106

如何登陆?跑到106机器跟前登录?ssh 输密码登录?
是否有一边的家目录加密了?

参考 https://help.ubuntu.com/community/SSH/OpenSSH/Keys#Troubleshooting

还有一个 debug 的办法是在服务端加上 -d 运行 sshd
在服务端运行:
代码:
service ssh stop
/usr/sbin/sshd -d

然后到客户端尝试用密钥连接,看服务端的输出

参考 http://unix.stackexchange.com/a/55481



就是ssh106登陆 然后103可以ssh免密码登
然后退出106的ssh 103就不行了
我先试试你的debug输出 你说的家目录加密 是不是装系统时勾选了ecryptfs加密?
== 我不能stop ssh 这机器在外地

/home/bfadmin/.Private ecryptfs 487G 6.9G 455G 2% /home/bfadmin
是否是因为这行挂载加密 影响了?


页首
 用户资料  
 
6 楼 
 文章标题 : Re: ssh信任有问题
帖子发表于 : 2016-03-24 14:35 
头像

注册: 2011-03-20 13:12
帖子: 4522
地址: 山东省寿光县
系统: Debian
送出感谢: 105
接收感谢: 997
o枫叶o飘零 写道:
说的家目录加密 是不是装系统时勾选了ecryptfs加密?
/home/bfadmin/.Private ecryptfs 487G 6.9G 455G 2% /home/bfadmin
是否是因为这行挂载加密 影响了?

是的
加密的是服务端还是客户端的家目录?
如果是服务端家目录被加密,需要 authorized_keys 移到非加密的分区/目录,再在 /etc/ssh/sshd_config 中相应设置。按 https://help.ubuntu.com/community/SSH/OpenSSH/Keys#Troubleshooting 操作。


_________________
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户


最后由 vickycq 编辑于 2016-03-24 14:35,总共编辑了 1 次

页首
 用户资料  
 
7 楼 
 文章标题 : Re: ssh信任有问题
帖子发表于 : 2016-03-24 14:35 

注册: 2015-03-10 16:39
帖子: 6
系统: ubuntu14.04
送出感谢: 0 次
接收感谢: 0 次
找到原因了 是因为加密了
在这个网站写着有https://pjf.name/post-482.html?utm_source=tuicool&utm_medium=referral


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 7 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 0 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译