多谢指点迷津,远程SSH 登录 mersdk时 总是提示无法链接 错误代码如下 itnet@PC-20110526DIDJ:~$ ssh -p 2222 -i ~/.ssh/mer-qt-creator-rsa mersdk@localhost
Agent admitted failure to sign using the key.
Agent admitted failure to sign using the key.
Permission denied (publickey).
itnet@PC-20110526DIDJ:~$ ssh -p 2222 -i ~/.ssh/mer-qt-creator-rsa.pub mersdk@localhost
Agent admitted failure to sign using the key.
Agent admitted failure to sign using the key.
Permission denied (publickey).
itnet@PC-20110526DIDJ:~$ ssh -p 2222 -i ~/.ssh/mer-qt-creator-rsa root@localhostAgent admitted failure to sign using the key.
Agent admitted failure to sign using the key.
Permission denied (publickey).
itnet@PC-20110526DIDJ:~$ ssh -i ~/.ssh/mer-qt-creator-rsa mersdk@localhost -p 2222
Agent admitted failure to sign using the key.
Agent admitted failure to sign using the key.
Permission denied (publickey).
后来进入调试模式观看错误原因 itnet@PC-20110526DIDJ:~$ ssh root@localhost -p 2222 -v -i ~/.ssh/mer-qt-creator-rsa
OpenSSH_6.0p1 Debian-4, OpenSSL 1.0.1c 10 May 2012
debug1: Connecting to localhost [::1] port 2222.
debug1: connect to address ::1 port 2222: Connection refused
debug1: Connecting to localhost [127.0.0.1] port 2222.
debug1: Connection established.
debug1: identity file /home/itnet/.ssh/mer-qt-creator-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/itnet/.ssh/mer-qt-creator-rsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.6
debug1: match: OpenSSH_5.6 pat OpenSSH_5*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.0p1 Debian-4
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: Server host key: RSA 08:2b:bc:09:14:1b:55:20:27:14:48:57:92:57:fa:5c
debug1: Host '[localhost]:2222' is known and matches the RSA host key.
debug1: Found key in /home/itnet/.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: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/itnet/.ssh/mer-qt-creator-rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
Agent admitted failure to sign using the key.
debug1: Offering RSA public key: QtCreator/2013-02-26T20:49:54
debug1: Server accepts key: pkalg ssh-rsa blen 279
Agent admitted failure to sign using the key.
debug1: No more authentication methods to try.
Permission denied (publickey).
依然没有找到为什么ssh 无法链接 后来在国外的一个论坛上找到了 需要先先将SSH_AUTH_SOCK 变量值清空 使用 unset SSH_AUTH_SOCK
然后才能正常链接。 果然可以了 截图如下 itnet@PC-20110526DIDJ:~$ unset SSH_AUTH_SOCK
itnet@PC-20110526DIDJ:~$ ssh root@localhost -p 2223 -v -i ~/.ssh/mer-qt-creator-rsa
OpenSSH_6.0p1 Debian-4, OpenSSL 1.0.1c 10 May 2012
debug1: Connecting to localhost [::1] port 2223.
debug1: connect to address ::1 port 2223: Connection refused
debug1: Connecting to localhost [127.0.0.1] port 2223.
debug1: Connection established.
debug1: identity file /home/itnet/.ssh/mer-qt-creator-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/itnet/.ssh/mer-qt-creator-rsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.6
debug1: match: OpenSSH_5.6 pat OpenSSH_5*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.0p1 Debian-4
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: Server host key: RSA 68:f2:02:16:8f:18:1e:bf:3d:e6:e7:df:80:23:1b:ea
debug1: Host '[localhost]:2223' is known and matches the RSA host key.
debug1: Found key in /home/itnet/.ssh/known_hosts:2
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
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/itnet/.ssh/mer-qt-creator-rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
Authenticated to localhost ([127.0.0.1]:2223).
debug1: channel 0: new [client-session]
debug1: Requesting
no-more-sessions@openssh.comdebug1: Entering interactive session.
[root@SailfishEmul ~]# exit