gpt4 book ai didi

windows - 在 Windows 8 上使用 SSH 连接到 Amazon EC2 的权限被拒绝

转载 作者:可可西里 更新时间:2023-11-01 09:53:31 25 4
gpt4 key购买 nike

我开始使用 Amazon EC2 服务。我已经安装了一个 Amazon Linux 实例,设置了 PEM 文件,打开了 SSH 端口并安装了一个 GIT 服务。

我的本​​地环境是 Windows 8。

通过 putty 和 WinSCP,我可以毫无问题地连接。我已经按照文档将我的 PEM 文件转换为 PPK,一切正常。问题是当我尝试从本地计算机执行 git push 时。当我尝试连接时,我总是收到“权限被拒绝(公钥)”。我使用 git bash 对 PEM 文件进行了 ssh-add,通过 GIT Bash 生成了一个自定义 key ,并将该 key 添加到 EC2 实例的 key 解析中,但没有任何效果...

如果我尝试(使用 git bash)a ssh -i 并指定 PEM 文件,我就有了连接。

ssh -i c:/[PATH]/[PEM-FILE].pem ec2-user@[HOST].compute.amazonaws.com

如果我尝试不使用 -i,则无法连接。

$ ssh ec2-user@[HOST].compute.amazonaws.com
Permission denied (publickey).

下面是使用 -vT 命令的跟踪:

ssh -vT ec2-user@[HOST].compute.amazonaws.com
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Connecting to [HOST].compute.amazonaws.com [54.201.
110.48] port 22.
debug1: Connection established.
debug1: identity file [PATH]/Usuario/.ssh/identity type -1
debug1: identity file [PATH]/Usuario/.ssh/id_rsa type 1
debug1: identity file [PATH]/Usuario/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.2
debug1: match: OpenSSH_6.2 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 '[HOST].compute.amazonaws.com' is known and ma
tches the RSA host key.
debug1: Found key in [PATH]/Usuario/.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
debug1: Next authentication method: publickey
debug1: Trying private key: [PATH]/Usuario/.ssh/identity
debug1: Offering public key: [PATH]/Usuario/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: [PATH]/Usuario/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).

那么,有没有 -i 选项通过 SSH 连接的方法?

最佳答案

经过几次尝试,我在这里找到了一篇带有一些说明的文章 https://serverfault.com/questions/194567/how-do-i-tell-git-for-windows-where-to-find-my-private-rsa-key

我遵循了这些步骤:“在您拥有主目录和该目录下的 .ssh 文件夹之后,您想要打开 PuTTYgen 并打开您之前创建的 key (.ppk 文件)。一旦您的 key 打开,您要选择 Conversions -> Export OpenSSH key 并将其保存到 HOME.ssh\id_rsa。在该位置获得 key 后,Git bash 将识别并使用该 key ”

关于windows - 在 Windows 8 上使用 SSH 连接到 Amazon EC2 的权限被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24037525/

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