1
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?

【EC2】Permissions 0644 for 'xxx.pem' are too open. It is required that your private key files are NOT accessible by others. This private key will be ignored.の解決方法

Posted at

はじめに

今回は、EC2インスタンスを起動し、SSH接続しようとした際に発生したエラーと、その解決方法について記録します。

現象

EC2サーバーにSSHコマンドで接続しようとすると、以下のエラーが表示されました。

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '[秘密鍵].pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "[秘密鍵].pem": bad permissions
[ユーザー]@[IPアドレス]: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

解決方法

秘密鍵ファイルのパーミッションが「0644」となっており、他のユーザーが閲覧できる状態になっていることが問題でした。

下記のコマンドで秘密鍵のパーミッションを「400」に変更します。

chmod 400 ~/.ssh/xxx.pem

再度、SSH接続を試すと問題なくログインできました。

終わりに

今後も学習を進めながら、得た知識を共有していきます!

参考

『Permissions 0644 for 'sample_rsa' are too open. 解決方法』 Qiita

1
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
1
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?