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

More than 3 years have passed since last update.

SSH接続時にIt is required that your private key files are NOT accessible by others. This private key will be ignored.が出たときの対処法

Posted at

はじめに

コンソールからAWSのインスタンスにSSH接続をしようとした際、下記のエラーが出た時の対処法です。

$ ssh -i key.pem ec2-user@XX.XXX.XX.XX   
                                                                                        
Warning: Permanently added 'XX.XXX.XX.XX' (ECDSA) to the list of known hosts.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for 'key.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 "XX.XXX.XX.XX.pem": bad permissions
ec2-user@XX.XXX.XX.XX: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

対処法

エラーの原因としては秘密鍵のパーミッションがオープンすぎるという事なので、パーミッションを変更してあげましょう。

$ sudo chmod 0600 key.pem

これで無事にSSH接続ができるかと思います。

$ ssh -i key.pem ec2-user@XX.XXX.XX.XX  
                                                                                                      
Warning: Permanently added 'XX.XXX.XX.XX' (ECDSA) to the list of known hosts.

       __|  __|_  )
       _|  (     /   Amazon Linux 2 AMI
      ___|\___|___|
3
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
3
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?