gpt4 book ai didi

ssh - Amazon LightSail 上的权限被拒绝

转载 作者:行者123 更新时间:2023-12-02 13:46:59 28 4
gpt4 key购买 nike

登录适用于 LightsailDefaultPrivateKey-eu-west-1.pem,但不适用于我自己的 key 对。

我尝试使用 'ssh-keygen -t rsa -b 4096 -C "my@email.com"-f ~/.ssh/lsail-mikemittererat-eu-west-1.pem' 生成 key

我还尝试在 AWS/S2 上生成一个 key ,下载它,用私钥生成一个公钥并将其上传到 LightSail - 相同的结果。它不起作用。

错误信息:
ssh -i ~/.ssh/ssh_my-website ubuntu@
权限被拒绝(公钥)。

如果我使用 -v 选项,这就是我得到的结果:

ssh -v -i ~/.ssh/lsail-mikemittererat-eu-west-1.pem ubuntu@<public ip>

OpenSSH_6.9p1, LibreSSL 2.1.8
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: /etc/ssh/ssh_config line 56: Applying options for *
debug1: Connecting to <public ip> [<public ip>] port 22.
debug1: Connection established.
debug1: identity file /Users/mikemitterer/.ssh/lsail-mikemittererat-eu-west-1.pem type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/mikemitterer/.ssh/lsail-mikemittererat-eu-west-1.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.4 pat OpenSSH* compat 0x04000000
debug1: Authenticating to <public ip>:22 as 'ubuntu'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client chacha20-poly1305@openssh.com <implicit> none
debug1: kex: client->server chacha20-poly1305@openssh.com <implicit> none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:6u6vqWOSbOSNiPYAOqa5q/epSntR7GG5dvFzKuUAJOQ
debug1: Host '<public ip>' is known and matches the ECDSA host key.
debug1: Found key in /Users/mikemitterer/.ssh/known_hosts:38
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: Offering RSA public key: /Users/mikemitterer/.ssh/lsail-mikemittererat-eu-west-1.pem
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

.pem 权限设置为 600,.ssh 设置为 700

最佳答案

我能够让这个工作如下:

  • 如上所述生成 SSH key 对 (ssh-keygen -t rsa -b 4096 -C "my@email.com"-f ~/certs/test.pem)
  • 更改了私钥文件的权限 (chmod 600 test.pem)
  • 使用 Lightsail 集成控制台 ssh 进入实例并将公钥添加到 ~/.ssh/authorized_keys 文件
  • 我能够使用 ssh -i ~/certs/lightsail.pem ubuntu@
  • 访问该实例

    让我知道这是否有效,或者我是否遗漏了什么。

    关于ssh - Amazon LightSail 上的权限被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49074262/

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