2017-08-20 29 views
0

SSHに接続しようとしていて、自分のRDSインスタンスに接続しようとしています。私は~/.ssh/configに私の資格情報を設定したAWS SSHとRDSパーミッションが拒否されました - 公開鍵

Permission denied (publickey).

:私が試した

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

  • チャン私はスルーでログインしようとすると、これがメッセージです

enter image description here

~/.ssh/ポート3306上のポート22とMYSQLのTCPのインバウンドルールを設定

  • 700への私の権限をするプロファイル:

    $ 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: [email protected] 
    debug1: kex: host key algorithm: ecdsa-sha2-nistp256 
    debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none 
    debug1: kex: client->server cipher: [email protected] 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). 
    

    これは、 o Sequel PRO経由でRDS DBに接続する:

    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 [email protected] -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: [email protected] 
    debug1: kex: host key algorithm: ecdsa-sha2-nistp256 
    debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none 
    debug1: kex: client->server cipher: [email protected] 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). 
    
    +0

    を参照してくださいインストールします。https://medium.com/@michalisantoniou6/connect-to-an-aws-rds-using-an-ssh -tunnel-22f3bd597924 – helloV

    +0

    鍵はサーバによって拒否されます。サーバーログがなければ、理由を推測することは不可能です。 – Jakuje

    +0

    SSH経由でMySQL接続をセットアップする必要があります。セキュリティ上の理由から、RDSと同じVPC内の制限付きアクセスインスタンスを使用しています。設定が完了したら、ターミナルからmysqlを使用するか、必要に応じてGUIを設定することができます(たとえば、Linuxをローカルに使用している場合はMySQL Workbenchなど)。 – Theyna

    答えて

    0

    SSH経由でAWS RDSインスタンスに直接アクセスすることはできません。 MySQLクライアントからアクセスできます。このリンクは、場合に役立ちます

    1. apt-get install MySQL-server -y
    2. 実行MySQL -h clg-api-staging -P password -p
    0

    SSHを使用してRDSに接続しようとすると、決して動作しません。 RDSは、SQL接続のみを許可し、SSHまたは他の管理者タイプのアクセスを指示しないデータベースサービスです。

    関連する問題