回答編集履歴

1

.ssh/configの設定を使うやり方を追記

2021/03/09 07:15

投稿

yu_1985
yu_1985

スコア7447

test CHANGED
@@ -1,3 +1,21 @@
1
1
  `-i`オプションで指定する鍵名が間違っています。
2
2
 
3
3
  ご自分で`~/.ssh/config`に設定した鍵名をよく確認してscpのオプションで指定してください。
4
+
5
+
6
+
7
+
8
+
9
+ あるいは、せっかく`~/.ssh/config`に接続情報を定義済みなのだから下記のようにすればいいでしょう。
10
+
11
+
12
+
13
+ ```bash
14
+
15
+ scp master.key heasecook-aws:/var/www/rails/app_for_job_change/config/master.key
16
+
17
+ ```
18
+
19
+ 参考
20
+
21
+ [scpで.ssh/configに登録しているhostを使う EC2ファイル編](https://ryo10leo.hatenablog.com/entry/2020/02/06/222244)