LoginSignup
5
5

More than 5 years have passed since last update.

SSH鍵(秘密鍵)でログインした際のパーミッションエラーの解決方法

Posted at

事象

SSH鍵でログインしようとした際に、秘密鍵にパーミッションエラーがでて、ログインができなかった。

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0755 for '/Users/suzuki/.ssh/xxxx.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 "/Users/suzuki/.ssh/xxxx.pem": bad permissions
debug1: No more authentication methods to try.
ec2-user@xx.xxx.xxx.xxx: Permission denied (publickey).

原因と対応方法

秘密鍵の権限が緩すぎた事が原因であった。

Permissions 0755 for '/Users/suzuki/.ssh/xxxx.pem' are too open.

外ユーザからアクセスできないようにし、自分のみにreadとwrite権限を付けることで解決した。

It is required that your private key files are NOT accessible by others

# 所有者にreadとwriteの権限を付与
chmod 600 xxxxxxxxxxx.pem
5
5
1

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
5
5