gpt4 book ai didi

git - OpenSSH 提供了错误的公钥?

转载 作者:行者123 更新时间:2023-12-02 14:23:08 27 4
gpt4 key购买 nike

我尝试将 ssh 配置为使用两个 Remote ,每个 Remote 都有不同的 key 对。因此,我创建了这个 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?

最佳答案

从您的日志中:

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 key ,它存在并且甚至被服务器接受。

你确定那个文件不存在吗?您确定您正在与正确的服务器通话吗?您确定您在服务器上正确配置了您的公钥吗?

关于git - OpenSSH 提供了错误的公钥?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21811490/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com