質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Amazon EC2

Amazon EC2は“Amazon Elastic Compute Cloud”の略称です。Amazon Web Services(AWS)の一部であり、仮想化されたWebサーバーのコンピュータリソースをレンタルできるサービスです。

AWS(Amazon Web Services)

Amazon Web Services (AWS)は、仮想空間を機軸とした、クラスター状のコンピュータ・ネットワーク・データベース・ストーレッジ・サポートツールをAWSというインフラから提供する商用サービスです。

Q&A

解決済

2回答

2609閲覧

AWS EC2上でのscpについて

humuhimi

総合スコア49

Amazon EC2

Amazon EC2は“Amazon Elastic Compute Cloud”の略称です。Amazon Web Services(AWS)の一部であり、仮想化されたWebサーバーのコンピュータリソースをレンタルできるサービスです。

AWS(Amazon Web Services)

Amazon Web Services (AWS)は、仮想空間を機軸とした、クラスター状のコンピュータ・ネットワーク・データベース・ストーレッジ・サポートツールをAWSというインフラから提供する商用サービスです。

0グッド

0クリップ

投稿2019/03/22 15:24

現在、ちょっとしたメモをEC2からダウンロードしようとしているのですがうまくいきまん。
同じ様にはまってしまったことのある方よろしくお願いします。
pemはあっているはずなのですが、なぜno such fileとかになるんですか?
ssh -i "12345678.pem" ec2-user@ec2-13-112-193-36.ap-northeast-1.compute.amazonaws.com
Warning: Identity file 12345678.pem not accessible: No such file or directory.
Permission denied (publickey).

debug

1debug1: Reading configuration data /etc/ssh/ssh_config 2debug1: /etc/ssh/ssh_config line 58: Applying options for * 3debug2: resolving "13.112.193.36" port 22 4debug2: ssh_connect_direct: needpriv 0 5debug1: Connecting to 13.112.193.36 [13.112.193.36] port 22. 6debug1: Connection established. 7debug1: key_load_public: No such file or directory 8debug1: identity file /home/ec2-user/.ssh/id_rsa type -1 9debug1: key_load_public: No such file or directory 10debug1: identity file /home/ec2-user/.ssh/id_rsa-cert type -1 11debug1: key_load_public: No such file or directory 12debug1: identity file /home/ec2-user/.ssh/id_dsa type -1 13debug1: key_load_public: No such file or directory 14debug1: identity file /home/ec2-user/.ssh/id_dsa-cert type -1 15debug1: key_load_public: No such file or directory 16debug1: identity file /home/ec2-user/.ssh/id_ecdsa type -1 17debug1: key_load_public: No such file or directory 18debug1: identity file /home/ec2-user/.ssh/id_ecdsa-cert type -1 19debug1: key_load_public: No such file or directory 20debug1: identity file /home/ec2-user/.ssh/id_ed25519 type -1 21debug1: key_load_public: No such file or directory 22debug1: identity file /home/ec2-user/.ssh/id_ed25519-cert type -1 23debug1: Enabling compatibility mode for protocol 2.0 24debug1: Local version string SSH-2.0-OpenSSH_7.4 25debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4 26debug1: match: OpenSSH_7.4 pat OpenSSH* compat 0x04000000 27debug2: fd 3 setting O_NONBLOCK 28debug1: Authenticating to 13.112.193.36:22 as 'ec2-user' 29debug3: hostkeys_foreach: reading file "/home/ec2-user/.ssh/known_hosts" 30debug3: record_hostkey: found key type ECDSA in file /home/ec2-user/.ssh/known_hosts:1 31debug3: load_hostkeys: loaded 1 keys from 13.112.193.36 32debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521 33debug3: send packet: type 20 34debug1: SSH2_MSG_KEXINIT sent 35debug3: receive packet: type 20 36debug1: SSH2_MSG_KEXINIT received 37debug2: local client KEXINIT proposal 38debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1,ext-info-c 39debug2: host key algorithms: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss 40debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc 41debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc 42debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 43debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 44debug2: compression ctos: none,zlib@openssh.com,zlib 45debug2: compression stoc: none,zlib@openssh.com,zlib 46debug2: languages ctos: 47debug2: languages stoc: 48debug2: first_kex_follows 0 49debug2: reserved 0 50debug2: peer server KEXINIT proposal 51debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 52debug2: host key algorithms: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519 53debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc,blowfish-cbc,cast128-cbc,3des-cbc 54debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc,blowfish-cbc,cast128-cbc,3des-cbc 55debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 56debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1 57debug2: compression ctos: none,zlib@openssh.com 58debug2: compression stoc: none,zlib@openssh.com 59debug2: languages ctos: 60debug2: languages stoc: 61debug2: first_kex_follows 0 62debug2: reserved 0 63debug1: kex: algorithm: curve25519-sha256 64debug1: kex: host key algorithm: ecdsa-sha2-nistp256 65debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none 66debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none 67debug1: kex: curve25519-sha256 need=64 dh_need=64 68debug1: kex: curve25519-sha256 need=64 dh_need=64 69debug3: send packet: type 30 70debug1: expecting SSH2_MSG_KEX_ECDH_REPLY 71debug3: receive packet: type 31 72debug1: Server host key: ecdsa-sha2-nistp256 SHA256:nSlGwxLQiCEZqPKUKLkuPGApzhmuJ9lAlZTUlTXHy60 73debug3: hostkeys_foreach: reading file "/home/ec2-user/.ssh/known_hosts" 74debug3: record_hostkey: found key type ECDSA in file /home/ec2-user/.ssh/known_hosts:1 75debug3: load_hostkeys: loaded 1 keys from 13.112.193.36 76debug1: Host '13.112.193.36' is known and matches the ECDSA host key. 77debug1: Found key in /home/ec2-user/.ssh/known_hosts:1 78debug3: send packet: type 21 79debug2: set_newkeys: mode 1 80debug1: rekey after 134217728 blocks 81debug1: SSH2_MSG_NEWKEYS sent 82debug1: expecting SSH2_MSG_NEWKEYS 83debug3: receive packet: type 21 84debug1: SSH2_MSG_NEWKEYS received 85debug2: set_newkeys: mode 0 86debug1: rekey after 134217728 blocks 87debug2: key: /home/ec2-user/.ssh/id_rsa ((nil)) 88debug2: key: /home/ec2-user/.ssh/id_dsa ((nil)) 89debug2: key: /home/ec2-user/.ssh/id_ecdsa ((nil)) 90debug2: key: /home/ec2-user/.ssh/id_ed25519 ((nil)) 91debug3: send packet: type 5 92debug3: receive packet: type 7 93debug1: SSH2_MSG_EXT_INFO received 94debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512> 95debug3: receive packet: type 6 96debug2: service_accept: ssh-userauth 97debug1: SSH2_MSG_SERVICE_ACCEPT received 98debug3: send packet: type 50 99debug3: receive packet: type 51 100debug1: Authentications that can continue: publickey 101debug3: start over, passed a different list publickey 102debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password 103debug3: authmethod_lookup publickey 104debug3: remaining preferred: keyboard-interactive,password 105debug3: authmethod_is_enabled publickey 106debug1: Next authentication method: publickey 107debug1: Trying private key: /home/ec2-user/.ssh/id_rsa 108debug3: no such identity: /home/ec2-user/.ssh/id_rsa: No such file or directory 109debug1: Trying private key: /home/ec2-user/.ssh/id_dsa 110debug3: no such identity: /home/ec2-user/.ssh/id_dsa: No such file or directory 111debug1: Trying private key: /home/ec2-user/.ssh/id_ecdsa 112debug3: no such identity: /home/ec2-user/.ssh/id_ecdsa: No such file or directory 113debug1: Trying private key: /home/ec2-user/.ssh/id_ed25519 114debug3: no such identity: /home/ec2-user/.ssh/id_ed25519: No such file or directory 115debug2: we did not send a packet, disable method 116debug1: No more authentication methods to try. 117Permission denied (publickey).

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

y_waiwai

2019/03/22 20:07

その、12345678.pemというファイルはどこにあるんでしょうか
humuhimi

2019/03/22 22:16

返信ありがとうございます。 macブックを使っているのですが、/Users/**** Users以下にあります。つまり、ホームディレクトリにあります。
guest

回答2

0

ベストアンサー

秘密鍵の置き場がパーミッション的に安全でない場合、そのようなエラーが発生する場合があります。

以下コマンドをまとめて実行し、適切なパーミッションにしてみてください。

cd $HOME chmod 700 . mkdir .ssh chmod 700 .ssh mv 12345678.pem .ssh/12345678.pem chmod 600 .ssh/12345678.pem

以下で接続します。

ssh -i .ssh/12345678.pem ec2-user@ec2-13-112-193-36.ap-northeast-1.compute.amazonaws.com

投稿2019/03/24 12:45

moonphase

総合スコア6621

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

その、12345678.pemのファイル指定をフルパスで指定してやってみたらどうでしょうか

投稿2019/03/23 00:30

y_waiwai

総合スコア87747

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問