日期:2014-05-16  浏览次数:20880 次

用SSH不能无密码登陆本机,好像是权限问题,但是结局不了,帮忙看看吧
每次链接都提示
Enter passphrase for key '/home/lingzhi/.ssh/id_rsa': 
需要问输入密码

下面是各个文件的权限

-rw-r--r--. 1 root root 394 6月 29 13:45 authorized_keys
-rw-------. 1 root root 788 6月 29 12:01 authorized_keys~
-rw-------. 1 lingzhi lingzhi 1743 6月 29 13:44 id_rsa
-rw-r--r--. 1 lingzhi lingzhi 394 6月 29 13:44 id_rsa.pub
-rw-r--r--. 1 lingzhi lingzhi 391 6月 29 13:46 known_hosts


这是问用 ssh localhost -v跟踪到

OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to localhost [127.0.0.1] port 22.
debug1: Connection established.
debug1: identity file /home/lingzhi/.ssh/identity type -1
debug1: identity file /home/lingzhi/.ssh/id_rsa type 1
debug1: identity file /home/lingzhi/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
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 'localhost' is known and matches the RSA host key.
debug1: Found key in /home/lingzhi/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure. Minor code may provide more information
Credentials cache file '/tmp/krb5cc_500' not found

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

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


debug1: Next authentication method: publickey
debug1: Trying private key: /home/lingzhi/.ssh/identity
debug1: Offering public key: /home/lingzhi/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
Enter passphrase for key '/home/lingzhi/.ssh/id_rsa': 
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env XMODIFIERS = @im=ibus
debug1: Sending env LANG = zh_CN.UTF-8
Last login: Fri Jun 29 13:46:37 2012 from localhost.localdomain





------解决方案--------------------
重启机子后,mac变化,与目的保存的mac不一致,ssh的时候会失败

我这边都是采用删除.ssh文件夹的方式

不知道你那边的情况是不是这样的
------解决方案--------------------
你生成key的时候问你私钥加密密码,这里不应该设置
设置了之后就需要你输入密码
除非你用代理,那样就搞的很复杂了
------解决方案--------------------
对,楼上的ckc说的很对
生成密钥时,不要输入密码,直接回车就可以