OpenSSH提供错误的公钥?

时间:2014-02-16 13:06:01

标签: git github ssh openssh

我尝试配置ssh以使用两个遥控器,每个遥控器都有一个不同的密钥对。因此,我创建了此config

UserKnownHostsFile ~/.ssh/known_hosts

Host github.com
    User git
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/github_rsa

Host git.cloudhost.io
    User git
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/cloudhost

与Github的连接工作正常。

> ssh -T github.com
Hi danijar! You've successfully authenticated, but GitHub does not provide shell
access.

但对于Cloudhost,连接失败。

> ssh -T git.cloudhost.io
Permission denied (publickey,password).

以下是Cloudhost的调试输出。

> ssh -v git.cloudhost.io
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Reading configuration data /c/Users/Name/.ssh/config
debug1: Applying options for git.cloudhost.io
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to git.cloudhost.io [31.220.27.160] port 22.
debug1: Connection established.
debug1: identity file /c/Users/Name/.ssh/cloudhost type 1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.1p1 Debian-4
debug1: match: OpenSSH_6.1p1 Debian-4 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc 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 'git.cloudhost.io' is known and matches the RSA host key.
debug1: Found key in /c/Users/Name/.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,password
debug1: Next authentication method: publickey
debug1: Offering public key: C:\\Users\\Name\\.ssh\\github_rsa
debug1: Authentications that can continue: publickey,password
debug1: Offering public key: C:\\Users\\Name\\.ssh\\github_rsa
debug1: Authentications that can continue: publickey,password
debug1: Offering public key: /c/Users/Name/.ssh/cloudhost
debug1: Authentications that can continue: publickey,password
debug1: No more authentication methods to try.
Permission denied (publickey,password).

Offering public key: /c/Users/Name/.ssh/cloudhost让我感到困惑,因为cloudhost是私钥。公钥名为cloudhost.pub

如何通过ssh将我的登录用户连接到Cloudhost?

1 个答案:

答案 0 :(得分:2)

从您的日志中

debug1: Reading configuration data /c/Users/Name/.ssh/config
debug1: Applying options for git.cloudhost.io
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *

这是正确的配置文件吗?请仔细检查两个文件的内容。

另见:

debug1: Offering public key: C:\\Users\\Name\\.ssh\\github_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: Authentication succeeded (publickey).

似乎它提供了你的github密钥,它存在,甚至被服务器接受。

您确定该文件不存在吗?您确定要与合适的服务器通话吗?您确定在服务器上正确配置了公钥吗?

相关问题