teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

追記

2021/05/16 02:50

投稿

yastinbieber
yastinbieber

スコア49

title CHANGED
File without changes
body CHANGED
@@ -112,4 +112,27 @@
112
112
  Rails 5.2.5
113
113
  ruby 2.5.1
114
114
  EC2
115
- AWS
115
+ AWS
116
+
117
+ ### 追記
118
+ ```
119
+ $ cd ~
120
+
121
+ $ mkdir ~/.ssh
122
+ # .sshというディレクトリを作成
123
+ # File existsとエラーが表示されたとしても、.sshディレクトリは存在しているということなので、そのまま進みましょう。
124
+
125
+ $ mv Downloads/ダウンロードした鍵の名前.pem .ssh/
126
+ # mvコマンドで、ダウンロードしたpemファイルを、ダウンロードディレクトリから、.sshディレクトリに移動します。
127
+
128
+ $ cd .ssh/
129
+
130
+ $ ls
131
+ # pemファイルが存在するか確認しましょう
132
+
133
+ $ chmod 600 ダウンロードした鍵の名前.pem
134
+
135
+ $ ssh -i ダウンロードした鍵の名前.pem ec2-user@作成したEC2インスタンスと紐付けたElastic IP
136
+ #(例えばElastic IPが123.456.789であれば、shh -i ダウンロードした鍵の名前.pem ec2-user@123.456.789 というコマンドになります)
137
+ #(ダウンロードした鍵を用いて、ec2-userとしてログイン)
138
+ ```

1

追記

2021/05/16 02:50

投稿

yastinbieber
yastinbieber

スコア49

title CHANGED
File without changes
body CHANGED
@@ -56,8 +56,60 @@
56
56
 
57
57
  すると2枚めのように『SSH接続が失敗しました』と表記が出てしまいます。
58
58
 
59
+ なお『詳細を表示』ボタンから確認できる内容は下記となります。
60
+ ```
61
+ Used command: /usr/bin/ssh -v -N -S none -o ControlMaster=no -o ExitOnForwardFailure=yes -o ConnectTimeout=10 -o NumberOfPasswordPrompts=3 -i /Users/yastinbieber/Downloads/torekabodymake_keypair.pem -o TCPKeepAlive=no -o ServerAliveInterval=60 -o ServerAliveCountMax=1 -p 22 ec2-user@54.249.173.184 -L 55060:127.0.0.1:3306
59
62
 
63
+ OpenSSH_8.1p1, LibreSSL 2.7.3
64
+ debug1: Reading configuration data /etc/ssh/ssh_config
65
+ debug1: /etc/ssh/ssh_config line 47: Applying options for *
66
+ debug1: Control socket " none" does not exist
67
+ debug1: Connecting to 54.249.173.184 [54.249.173.184] port 22.
68
+ debug1: fd 3 clearing O_NONBLOCK
69
+ debug1: Connection established.
70
+ debug1: identity file /Users/yastinbieber/Downloads/torekabodymake_keypair.pem type -1
71
+ debug1: identity file /Users/yastinbieber/Downloads/torekabodymake_keypair.pem-cert type -1
72
+ debug1: Local version string SSH-2.0-OpenSSH_8.1
73
+ debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
74
+ debug1: match: OpenSSH_7.4 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
75
+ debug1: Authenticating to 54.249.173.184:22 as 'ec2-user'
76
+ debug1: SSH2_MSG_KEXINIT sent
77
+ debug1: SSH2_MSG_KEXINIT received
78
+ debug1: kex: algorithm: curve25519-sha256
79
+ debug1: kex: host key algorithm: ecdsa-sha2-nistp256
80
+ debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
81
+ debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
82
+ debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
83
+ debug1: Server host key: ecdsa-sha2-nistp256 SHA256:273QxtYusMEyPX3qA2kiWHOeU2qyePbJKjRbAGdZNFA
84
+ debug1: Host '54.249.173.184' is known and matches the ECDSA host key.
85
+ debug1: Found key in /Users/yastinbieber/.ssh/known_hosts:1
86
+ debug1: rekey out after 134217728 blocks
87
+ debug1: SSH2_MSG_NEWKEYS sent
88
+ debug1: expecting SSH2_MSG_NEWKEYS
89
+ debug1: SSH2_MSG_NEWKEYS received
90
+ debug1: rekey in after 134217728 blocks
91
+ debug1: Will attempt key: /Users/yastinbieber/Downloads/torekabodymake_keypair.pem explicit
92
+ debug1: SSH2_MSG_EXT_INFO received
93
+ debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
94
+ debug1: SSH2_MSG_SERVICE_ACCEPT received
95
+ debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
96
+ debug1: Next authentication method: publickey
97
+ debug1: Trying private key: /Users/yastinbieber/Downloads/torekabodymake_keypair.pem
98
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
99
+ @ WARNING: UNPROTECTED PRIVATE KEY FILE! @
100
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
101
+ Permissions 0644 for '/Users/yastinbieber/Downloads/torekabodymake_keypair.pem' are too open.
102
+ It is required that your private key files are NOT accessible by others.
103
+ This private key will be ignored.
104
+ Load key "/Users/yastinbieber/Downloads/torekabodymake_keypair.pem": bad permissions
105
+ debug1: No more authentication methods to try.
106
+ ec2-user@54.249.173.184: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
107
+ ```
60
108
 
109
+ 恐れ入りますが要因がわかる方ご教示いただけますと幸いです。
110
+
61
111
  ### 補足情報(FW/ツールのバージョンなど)
62
-
63
- ここにより詳細な情報を記載してください。
112
+ Rails 5.2.5
113
+ ruby 2.5.1
114
+ EC2
115
+ AWS