LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1196|回复: 4

『以解决』利用公钥无密码登录ssh的问题

[复制链接]
发表于 2010-10-21 13:39:36 | 显示全部楼层 |阅读模式
用ssh-keygen 重新生成了一个密钥对,但是没有使用默认的文件名,自己起了个文件名,上传后,就一切OK


严格按照网上的教程上传公钥到服务器
一开始一切顺利
后来locale系统重装了一次以后
把服务器上.ssh删除
重新安装网上的教程上传公钥到服务器,但是这次死活就不行了!
然后,在locale上用另外一个别人的ssh账户上传公钥,用别人的账户登录服务器,可以成功不用密码登录
可是我的账户死活就是不能无密码登录!!!
不知道我说清楚了没有?
ssh -v 信息如下:
tomcat@tomcat:~$ ssh -v zhu001
OpenSSH_5.5p1 Debian-5, OpenSSL 0.9.8o 01 Jun 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to zhu001 [10.10.116.66] port 22.
debug1: Connection established.
debug1: identity file /home/tomcat/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/tomcat/.ssh/id_rsa-cert type -1
debug1: identity file /home/tomcat/.ssh/id_dsa type -1
debug1: identity file /home/tomcat/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 1.99, remote software version OpenSSH_3.9p1
debug1: match: OpenSSH_3.9p1 pat OpenSSH_3.*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.5p1 Debian-5
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'zhu001' is known and matches the RSA host key.
debug1: Found key in /home/tomcat/.ssh/known_hosts:6
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
Credentials cache file '/tmp/krb5cc_2704' not found

debug1: Unspecified GSS failure.  Minor code may provide more information
Credentials cache file '/tmp/krb5cc_2704' not found

debug1: Unspecified GSS failure.  Minor code may provide more information


debug1: Next authentication method: publickey
debug1: Offering public key: /home/tomcat/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Trying private key: /home/tomcat/.ssh/id_dsa
debug1: Next authentication method: password
tomcat@zhu001's password:
发表于 2010-10-21 22:58:07 | 显示全部楼层
2个登录过程能比较一下么?
回复 支持 反对

使用道具 举报

发表于 2010-10-22 02:31:00 | 显示全部楼层
会不会是这个?
http://lists.debian.org/debian-s ... /2008/msg00152.html

虽然已经很久了,你的服务器上用的ssh版本号是多少?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-10-22 10:38:47 | 显示全部楼层
Post by blue_stone;2116727
2个登录过程能比较一下么?

对比了一下

  1. 前面的一样
复制代码


成功无密码登录的代码如下:

  1. debug1: Next authentication method: publickey
  2. debug1: Trying private key: /home/xinchangpeng/.ssh/id_rsa
  3. debug1: read PEM private key done: type RSA
  4. debug1: Authentication succeeded (publickey).
  5. debug1: channel 0: new [client-session]
  6. debug1: Entering interactive session.
  7. debug1: Sending environment.
  8. debug1: Sending env LANG = en_US.UTF-8
  9. Last login: Thu Oct 21 13:40:14 2010 from xxx
  10. -bash-3.00$
复制代码

未成功的代码如下:

  1. debug1: Next authentication method: publickey
  2. debug1: Trying private key: /home/xinchangpeng/.ssh/id_rsa
  3. debug1: read PEM private key done: type RSA
  4. debug1: Authentications that can continue: publickey,gssapi-with-mic,password
  5. debug1: Trying private key: /home/xinchangpeng/.ssh/id_dsa
  6. debug1: Next authentication method: password
复制代码
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-10-22 10:48:55 | 显示全部楼层
Post by pingz;2116750
会不会是这个?
http://lists.debian.org/debian-s ... /2008/msg00152.html

虽然已经很久了,你的服务器上用的ssh版本号是多少?


本地机

  1. OpenSSH_5.5p1 Debian-5+b1, OpenSSL 0.9.8o 01 Jun 2010
复制代码


服务器

  1. OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003
复制代码
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表