WARNING: UNPROTECTED PRIVATE KEY FILE! error message
Was trying to ssh into my Amazon Web Services EC2 instances yesterday
ssh -i ec2-webserver.pem root@ec2-***.compute-1.amazonaws.com
and encountered this funky error message :
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0440 for 'ec2-webserver.pem' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: ec2-webserver.pem
Password:
Upon further investigation, found out that this problem is actually caused by OpenSSH client security policy rather than AWS EC2.
To fix this error, change the permission of the /.ssh
directory to 0700
and the ec2-webserver.pem file to 0600
chmod 0700 $HOME/.ssh/
chmod 0600 $HOME/ec2-webserver.pem
Try the ssh command again and bingo! No more WARNING: UNPROTECTED PRIVATE KEY FILE!
error message
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+12.1k Golang : Print UTF-8 fonts on image example
+10.3k Golang : Generate 403 Forbidden to protect a page or prevent indexing by search engine
+25.2k Golang : Daemonizing a simple web server process example
+14.2k How to automatically restart your crashed Golang server
+7.2k Golang : How to convert strange string to JSON with json.MarshalIndent
+8k Golang : Reverse text lines or flip line order example
+17.3k Golang : Find smallest number in array
+9.9k Golang : Edge detection with Sobel method
+12.2k Golang : Search and extract certain XML data example
+10.8k Golang : Create S3 bucket with official aws-sdk-go package
+4.4k Linux : sudo yum updates not working
+11.7k Golang : Convert decimal number(integer) to IPv4 address