53

EC2 サーバーに ssh できず、次のエラーが表示されます。

ssh -i /Users/Skeniver/Keepass/skeniver.pem ubuntu@xx.xxx.xx.xxx

Identity file /Users/Skeniver/Keepass/skeniver.pem not accessible: No such file or directory

ファイルは間違いなくディレクトリにあり、ディレクトリを 755 に、ファイルを 600 に chmod しました。

drwxr-xr-x  14 Skeniver  staff    476 28 Nov  2012 Keepass
-rw-------  1 Skeniver  staff    1696  5 Oct  2012 skeniverkey.pem

権限の問題だと確信していますが、理由がわかりません...

-v を使用した ssh コマンドの出力を次に示します。

Warning: Identity file /Users/Skeniver/Keepass/skeniver.pem not accessible: No such file or directory.
OpenSSH_5.2p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to xx.xxx.xx.xxx [xx.xxx.xx.xxx] port 22.
debug1: Connection established.
debug1: identity file /Users/Skeniver/.ssh/identity type -1
debug1: identity file /Users/Skeniver/.ssh/id_rsa type 1
debug1: identity file /Users/Skeniver/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.2
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr 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 'xx.xxx.xx.xxx' is known and matches the RSA host key.
debug1: Found key in /Users/Skeniver/.ssh/known_hosts:8
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: Offering public key: /Users/Skeniver/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/Skeniver/.ssh/identity
debug1: Trying private key: /Users/Skeniver/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).
4

15 に答える 15

31

ボックスにログインするには、ID ファイルが必要です。次のコマンドを使用します。

ssh -i (identity_file) username@hostname"

これは私にとってはうまくいきました。入力を求める Amazon EC2 チュートリアルとは異なり、ファイル名だけを (スラッシュなしで) 書きます。

ssh -i /path/key_pair.pem ec2-user@public_dns_name

自宅の .ssh (非表示) フォルダーに ID ファイルを配置すると、うまくいきました。ホームの隠しフォルダを表示するには、次を使用しますctrl+h

于 2013-09-26T23:47:05.583 に答える
3

私は同じ問題を抱えていましたが、ファイルパスに問題があることがわかりました。key_pair.pem (同一ファイル) を右クリックしてプロパティに移動し、コピーすると、コメントは次のようになります。

ssh -i /path/skeniver.pem user@your_public_ip

たとえば、私の場合、次のようなコマンド

ssh -i /home/anil/.ssh/webKey.pem ec2-user@ec2-45-349-50-38.us-west-2.compute.amazonaws.com
于 2018-06-13T18:53:57.360 に答える
-2

ボックスにログインするには、ID ファイルが必要です。コマンドを使用する

ssh -i (identity_file) username@hostname
于 2013-06-11T06:47:57.847 に答える