gpt4 book ai didi

mysql - AWS SSH 和 RDS 权限被拒绝 - 公钥

转载 作者:行者123 更新时间:2023-11-29 18:29:50 27 4
gpt4 key购买 nike

我正在尝试通过 SSH 连接到我的 RDS 实例。两者都不起作用,给出相同的错误:

Permission denied (publickey).

我已在 ~/.ssh/config 中设置了我的凭据:

Host clg-api-staging
HostName ec2-11-111-11-11.compute-1.amazonaws.com
User ec2-user
IdentityFile ~/.ssh/clg-api-staging.pem

我已经尝试过:

  • 更改我对 pem 文件的权限:chmod 600 ~/.ssh/clg-api-staging.pem

  • 将我对 ~/.ssh/ 的权限更改为 700

  • 为端口 22 上的 TCP 和端口 3306 上的 MYSQL 设置入站规则:

enter image description here

这是我尝试通过配置文件登录时出现的消息:

$ ssh -v clg-api-staging

OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /Users/danniu/.ssh/config
debug1: /Users/danniu/.ssh/config line 26: Applying options for clg-api-staging
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to ec2-34-196-57-20.compute-1.amazonaws.com [34.196.57.20] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /Users/danniu/.ssh/clg-api-staging.pem type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/danniu/.ssh/clg-api-staging.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1
debug1: match: OpenSSH_6.6.1 pat OpenSSH_6.6.1* compat 0x04000000
debug1: Authenticating to ec2-34-196-57-20.compute-1.amazonaws.com:22 as 'ec2-user'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:pATHD/i/BUstt1K3QKzJB4kNJyIQJUoFNpmpsot/5Lg
debug1: Host 'ec2-34-196-57-20.compute-1.amazonaws.com' is known and matches the ECDSA host key.
debug1: Found key in /Users/danniu/.ssh/known_hosts:24
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: Skipping ssh-dss key /Users/danniu/.ssh/id_dsa - not in PubkeyAcceptedKeyTypes
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/danniu/.ssh/github_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/danniu/.ssh/clg-api-staging.pem
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

这是尝试通过 Sequel PRO 连接到 RDS 数据库时的消息:

Used command:  /usr/bin/ssh -v -N -S none -o ControlMaster=no -o ExitOnForwardFailure=yes -o ConnectTimeout=10 -o NumberOfPasswordPrompts=3 -i /Users/danniu/.ssh/clg-api-staging.pem -o TCPKeepAlive=no -o ServerAliveInterval=60 -o ServerAliveCountMax=1 ec2-user@ec2-34-196-57-20.compute-1.amazonaws.com -L 55318:aa1tgl9qfl015rk.cuqlyug9ccbu.us-east-1.rds.amazonaws.com:3306

OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /Users/danniu/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Control socket " none" does not exist
debug1: Connecting to ec2-34-196-57-20.compute-1.amazonaws.com [34.196.57.20] port 22.
debug1: fd 8 clearing O_NONBLOCK
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /Users/danniu/.ssh/clg-api-staging.pem type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/danniu/.ssh/clg-api-staging.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1
debug1: match: OpenSSH_6.6.1 pat OpenSSH_6.6.1* compat 0x04000000
debug1: Authenticating to ec2-34-196-57-20.compute-1.amazonaws.com:22 as 'ec2-user'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:pATHD/i/BUstt1K3QKzJB4kNJyIQJUoFNpmpsot/5Lg
debug1: read_passphrase: can't open /dev/tty: Device not configured
debug1: permanently_drop_suid: 501
Warning: Permanently added 'ec2-34-196-57-20.compute-1.amazonaws.com,34.196.57.20' (ECDSA) to the list of known hosts.
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: Skipping ssh-dss key /Users/danniu/.ssh/id_dsa - not in PubkeyAcceptedKeyTypes
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/danniu/.ssh/github_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/danniu/.ssh/clg-api-staging.pem
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

最佳答案

您无法通过 SSH 直接访问 AWS RDS 实例。您可以通过MySQL客户端访问它。

  1. 安装apt-get install MySQL-server -y
  2. 运行MySQL -h clg-api-staging -P 密码-p

关于mysql - AWS SSH 和 RDS 权限被拒绝 - 公钥,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45787523/

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