【问题标题】:Unable to connect to EC2 instance with error, Permission denied (publickey,gssapi-keyex,gssapi-with-mic)无法连接到 EC2 实例并出现错误,权限被拒绝 (publickey,gssapi-keyex,gssapi-with-mic)
【发布时间】:2021-12-16 20:48:23
【问题描述】:

我正在尝试连接到创建的 ec2 实例,并且我正在使用正确的 pem 文件,但出现权限被拒绝错误。我正在附加堆栈,请帮助

OpenSSH_7.5p1, OpenSSL 1.0.2o  27 Mar 2018
debug1: Reading configuration data /home/mobaxterm/.ssh/config
debug1: /home/mobaxterm/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 13: Deprecated option "useroaming"
debug1: Connecting to ec2-3-87-194-41.compute-1.amazonaws.com [3.87.194.41] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file git.pem type -1
debug1: key_load_public: No such file or directory
debug1: identity file git.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.5
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.0
debug1: match: OpenSSH_8.0 pat OpenSSH* compat 0x04000000
debug1: Authenticating to ec2-3-87-194-41.compute-1.amazonaws.com:22 as 'ec2-user'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha1 compression: zlib@openssh.com
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha1 compression: zlib@openssh.com
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:zGgdD+4VYOiiGb6LDf12e/Zhd4DjIN9qqSQtXtm/I8o
debug1: Host 'ec2-3-87-194-41.compute-1.amazonaws.com' is known and matches the RSA host key.
debug1: Found key in /home/mobaxterm/.ssh/known_hosts:3
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 4294967296 blocks
debug1: pubkey_prepare: ssh_fetch_identitylist: agent refused operation
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: Next authentication method: publickey
debug1: Trying private key: git.pem
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: No more authentication methods to try.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

【问题讨论】:

    标签: amazon-ec2 ssh permission-denied


    【解决方案1】:

    您是否尝试过用户root

    有时,取决于您选择的 AMI,您必须使用不同的用户名(例如 ubuntu)进行连接。

    当您尝试使用 root 登录时,服务器会回复您说您需要使用哪个用户。

    Please login as the user "ubuntu" rather than the user "root".
    

    试试这个

    ssh root@ec2-3-87-194-41.compute-1.amazonaws.com
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-06-09
      • 1970-01-01
      • 2020-06-01
      • 2016-03-03
      • 1970-01-01
      • 2013-05-19
      • 2021-03-12
      • 2017-12-21
      相关资源
      最近更新 更多