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

質問編集履歴

6

修正

2020/11/11 04:40

投稿

yutaro_0529
yutaro_0529

スコア12

title CHANGED
File without changes
body CHANGED
@@ -27,7 +27,7 @@
27
27
  1: from /Users/uraokayuutarou/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sshkit-1.21.0/lib/sshkit/backends/connection_pool.rb:63:in `call'
28
28
  /Users/uraokayuutarou/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/net-ssh-6.1.0/lib/net/ssh.rb:268:in `start': Authentication failed for user Yutaro.Uraoka@54.248.24.69 (Net::SSH::AuthenticationFailed)
29
29
  1: from /Users/uraokayuutarou/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sshkit-1.21.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
30
- /Users/uraokayuutarou/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sshkit-1.21.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as Yutaro.Uraoka@54.248.24.69: Authentication failed for user Yutaro.Uraoka@xx.xxx.xx.xx (SSHKit::Runner::ExecuteError)
30
+ /Users/uraokayuutarou/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sshkit-1.21.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as Yutaro.Uraoka@xx.xxx.xx.xx: Authentication failed for user Yutaro.Uraoka@xx.xxx.xx.xx (SSHKit::Runner::ExecuteError)
31
31
  (Backtrace restricted to imported tasks)
32
32
  cap aborted!
33
33
  SSHKit::Runner::ExecuteError: Exception while executing as Yutaro.Uraoka@xx.xxx.xx.xx: Authentication failed for user Yutaro.Uraoka@xx.xxx.xx.xx

5

追加で試したこと

2020/11/11 04:40

投稿

yutaro_0529
yutaro_0529

スコア12

title CHANGED
File without changes
body CHANGED
@@ -51,6 +51,10 @@
51
51
  sshを追加しようと、ssh-add ~/.ssh/hoge.pemを実行してみましたが、
52
52
  うまくいかず質問させていただきました。
53
53
 
54
+ ssh-copy-id を使用して登録しようとしても手動で登録しようとしてもうまくいきませんでした。
55
+ 秘密鍵はキーペアで作成しているものの、公開鍵はどう設定して良いのかわからない状態で終了しています。
56
+
57
+
54
58
  ```terminal
55
59
  uraokayuutarou@uraokayuutarou-no-MacBook .ssh % ssh -i xxxxxxxx.pem ec2-user@54.248.24.69
56
60
  Last login: Tue Nov 10 06:24:37 2020 from 137.140.5.103.wi-fi.wi2.ne.jp
@@ -110,6 +114,24 @@
110
114
  [ec2-user@ip-172-31-45-251 nostalgia]$
111
115
  ```
112
116
 
117
+ ```terminal
118
+ https://aws.amazon.com/amazon-linux-2/
119
+ [ec2-user@ip-172-31-45-251 ~]$ mkdir .ssh
120
+ mkdir: ディレクトリ `.ssh' を作成できません: File exists
121
+ [ec2-user@ip-172-31-45-251 ~]$ touch .ssh/authorized_keys
122
+ [ec2-user@ip-172-31-45-251 ~]$ chmod 700 .ssh
123
+ [ec2-user@ip-172-31-45-251 ~]$ chmod 600 .ssh/authorized_keys
124
+ [ec2-user@ip-172-31-45-251 ~]$ cat ~/.ssh/id_rsa.pub | ssh -i xxxxxxxxx.pem ec2-user@xx.xxx.xx.xx 'cat >> .ssh/authorized_keys'
125
+ Warning: Identity file xxxxxxx.pem not accessible: No such file or directory.
126
+ The authenticity of host '54.248.24.69 (54.248.24.69)' can't be established.
127
+ ECDSA key fingerprint is SHA256:lLzqkqg3f5NLltGU++DHfcxavWesbyq92o4DDfV3Iw8.
128
+ ECDSA key fingerprint is MD5:e0:7f:2f:a5:50:eb:3f:45:bc:b7:bf:31:8d:47:50:34.
129
+ Are you sure you want to continue connecting (yes/no)? y
130
+ Please type 'yes' or 'no': y
131
+ Please type 'yes' or 'no': y
132
+ Please type 'yes' or 'no':
133
+ ```
134
+
113
135
  ### 補足情報(FW/ツールのバージョンなど)
114
136
 
115
137
  設定ファイル
@@ -168,30 +190,28 @@
168
190
  # capistranoのバージョンを記載。固定のバージョンを利用し続け、バージョン変更によるトラブルを防止する
169
191
  lock '3.14.1'
170
192
 
171
- # Capistranoのログの表示に利用する
193
+
172
194
  set :application, 'nostalgia'
173
195
 
174
- # どのリポジトリからアプリをpullするかを指定する
175
196
  set :repo_url, 'git@github.com:uraokayutaro1990/nostalgia.git'
176
197
 
177
- # バージョンが変わっても共通で参照するディレクトリを指定
178
198
  set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system', 'public/uploads')
179
199
 
180
200
  set :rbenv_type, :user
181
- set :rbenv_ruby, '2.6.5p114' #カリキュラム通りに進めた場合、’2.6.5’ です
201
+ set :rbenv_ruby, '2.6.5p114'
182
202
 
183
203
  # どの公開鍵を利用してデプロイするか
184
204
  set :ssh_options, auth_methods: ['publickey'],
185
205
  keys: ['~/.ssh/xxxxxxxxxx.pem']
186
206
 
187
- # プロセス番号を記載したファイルの場所
207
+
188
208
  set :unicorn_pid, -> { "#{shared_path}/tmp/pids/unicorn.pid" }
189
209
 
190
- # Unicornの設定ファイルの場所
210
+
191
211
  set :unicorn_config_path, -> { "#{current_path}/config/unicorn.rb" }
192
212
  set :keep_releases, 5
193
213
 
194
- # デプロイ処理が終わった後、Unicornを再起動するための記述
214
+
195
215
  after 'deploy:publishing', 'deploy:restart'
196
216
  namespace :deploy do
197
217
  task :restart do

4

修正

2020/11/11 04:30

投稿

yutaro_0529
yutaro_0529

スコア12

title CHANGED
File without changes
body CHANGED
@@ -27,7 +27,7 @@
27
27
  1: from /Users/uraokayuutarou/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sshkit-1.21.0/lib/sshkit/backends/connection_pool.rb:63:in `call'
28
28
  /Users/uraokayuutarou/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/net-ssh-6.1.0/lib/net/ssh.rb:268:in `start': Authentication failed for user Yutaro.Uraoka@54.248.24.69 (Net::SSH::AuthenticationFailed)
29
29
  1: from /Users/uraokayuutarou/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sshkit-1.21.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
30
- /Users/uraokayuutarou/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sshkit-1.21.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as Yutaro.Uraoka@54.248.24.69: Authentication failed for user Yutaro.Uraoka@54.248.24.69 (SSHKit::Runner::ExecuteError)
30
+ /Users/uraokayuutarou/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sshkit-1.21.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as Yutaro.Uraoka@54.248.24.69: Authentication failed for user Yutaro.Uraoka@xx.xxx.xx.xx (SSHKit::Runner::ExecuteError)
31
31
  (Backtrace restricted to imported tasks)
32
32
  cap aborted!
33
33
  SSHKit::Runner::ExecuteError: Exception while executing as Yutaro.Uraoka@xx.xxx.xx.xx: Authentication failed for user Yutaro.Uraoka@xx.xxx.xx.xx
@@ -52,7 +52,7 @@
52
52
  うまくいかず質問させていただきました。
53
53
 
54
54
  ```terminal
55
- uraokayuutarou@uraokayuutarou-no-MacBook .ssh % ssh -i nostalgia2020.pem ec2-user@54.248.24.69
55
+ uraokayuutarou@uraokayuutarou-no-MacBook .ssh % ssh -i xxxxxxxx.pem ec2-user@54.248.24.69
56
56
  Last login: Tue Nov 10 06:24:37 2020 from 137.140.5.103.wi-fi.wi2.ne.jp
57
57
 
58
58
  __| __|_ )
@@ -69,18 +69,18 @@
69
69
  ec2-user 23647 0.0 0.0 119436 968 pts/5 S+ 06:41 0:00 grep --color=auto unicorn
70
70
  [ec2-user@ip-172-31-45-251 ~]$ ssh-add ~/.ssh/hoge.pem
71
71
  Could not open a connection to your authentication agent.
72
- [ec2-user@ip-172-31-45-251 ~]$ chmod 600 nostalgia2020.pem
72
+ [ec2-user@ip-172-31-45-251 ~]$ chmod 600 xxxxxxxxx.pem
73
73
  chmod: `nostalgia2020.pem' にアクセスできません: No such file or directory
74
74
  [ec2-user@ip-172-31-45-251 ~]$ cd ~
75
75
  [ec2-user@ip-172-31-45-251 ~]$ cd .ssh/
76
76
  [ec2-user@ip-172-31-45-251 .ssh]$ ls
77
77
  authorized_keys id_rsa id_rsa.pub known_hosts
78
- [ec2-user@ip-172-31-45-251 .ssh]$ chmod 600 nostalgia2020.pem
78
+ [ec2-user@ip-172-31-45-251 .ssh]$ chmod 600 xxxxxxxxxx.pem
79
79
  chmod: `nostalgia2020.pem' にアクセスできません: No such file or directory
80
80
  [ec2-user@ip-172-31-45-251 .ssh]$ exit
81
81
  ログアウト
82
82
  Connection to 54.248.24.69 closed.
83
- uraokayuutarou@uraokayuutarou-no-MacBook .ssh % ssh -i nostalgia2020.pem ec2-user@54.248.24.69
83
+ uraokayuutarou@uraokayuutarou-no-MacBook .ssh % ssh -i xxxxxxxxxx0.pem ec2-user@54.248.24.69
84
84
  Last login: Tue Nov 10 06:39:30 2020 from 137.140.5.103.wi-fi.wi2.ne.jp
85
85
 
86
86
  __| __|_ )
@@ -182,7 +182,7 @@
182
182
 
183
183
  # どの公開鍵を利用してデプロイするか
184
184
  set :ssh_options, auth_methods: ['publickey'],
185
- keys: ['~/.ssh/nostalgia2020.pem']
185
+ keys: ['~/.ssh/xxxxxxxxxx.pem']
186
186
 
187
187
  # プロセス番号を記載したファイルの場所
188
188
  set :unicorn_pid, -> { "#{shared_path}/tmp/pids/unicorn.pid" }

3

タイトル補足

2020/11/10 10:38

投稿

yutaro_0529
yutaro_0529

スコア12

title CHANGED
@@ -1,1 +1,1 @@
1
- EC2にCapistranoを導入して自動デプロイの確認中にsshのエラーが発生しました。
1
+ EC2にCapistranoを導入して自動デプロイの確認中にsshのエラーが発生しました。ssh-add -l で確認してもsshを確認することが出来ませんでした。
body CHANGED
File without changes

2

ssh-add -lの実行結果

2020/11/10 08:09

投稿

yutaro_0529
yutaro_0529

スコア12

title CHANGED
File without changes
body CHANGED
@@ -93,8 +93,23 @@
93
93
  Could not open a connection to your authentication agent.
94
94
  [ec2-user@ip-172-31-45-251 nostalgia]$
95
95
 
96
+
96
97
  ```
98
+ 登録されているsshの鍵を確認しようとしましたが、
99
+ 接続を開くことができませんでした。
100
+ 個人開発のディレクトリに入って実行もしてみましたが、
101
+ 同じエラー(Could not open a connection to your authentication agent.)が出てきました。
97
102
 
103
+ ```termnal
104
+ https://aws.amazon.com/amazon-linux-2/
105
+ [ec2-user@ip-172-31-45-251 ~]$ ssh-add -l
106
+ Could not open a connection to your authentication agent.
107
+ [ec2-user@ip-172-31-45-251 ~]$ cd /var/www/nostalgia
108
+ [ec2-user@ip-172-31-45-251 nostalgia]$ ssh-add -l
109
+ Could not open a connection to your authentication agent.
110
+ [ec2-user@ip-172-31-45-251 nostalgia]$
111
+ ```
112
+
98
113
  ### 補足情報(FW/ツールのバージョンなど)
99
114
 
100
115
  設定ファイル

1

タイトルの変更

2020/11/10 08:08

投稿

yutaro_0529
yutaro_0529

スコア12

title CHANGED
@@ -1,1 +1,1 @@
1
- EC2に自動デプロイしようとしたところsshのエラーが発生しました。
1
+ EC2にCapistranoを導入して自動デプロイの確認中にsshのエラーが発生しました。
body CHANGED
File without changes