0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

概要

MacからVSCodeのRemote SSHでAWS EC2に接続し用とした際に接続できなかった。

Configファイルは以下のようにしていました。

Host docker-demo
  HostName xxxxxxxxxxxxx (public ip addressコピペしています)
  User ubuntu
  IdentityFile ~/.ssh/xxx.pem

ログを見ていると以下のようなものが目に入りました。

log
Load key "~.ssh/xxx.pem": bad permissions 

なるほど?permissions?何を付ければいいの?ということで調査開始。

原因 / 解決策

私の場合はpemファイルのパーミッションに問題があったようです。

公開鍵認証方式でのパーミッション指定は以下である必要があるそうです。

  • ホームディレクトリのパーミッションは 755 以下であること
  • .ssh ディレクトリのパーミッションは 700
  • .ssh/authorized_keys のパーミッションは 600

pemファイル (xxx.pem) のパーミッションを600にしたら接続できました。

chmod 600 xxx.pem

めでたしめでたし。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?