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
+16.3k Golang : Set up source IP address before making HTTP request
+18.3k Golang : convert int to string
+10.2k Golang : How to delete element(data) from map ?
+18.4k Golang : Delete duplicate items from a slice/array
+7k Golang : Word limiter example
+14.8k nginx: [emerg] unknown directive "ssl"
+12.2k Swift : Convert (cast) Int or int32 value to CGFloat
+4.5k Javascript : How to get width and height of a div?
+8.4k Golang : Accept any number of function arguments with three dots(...)
+11k Golang : How to flush a channel before the end of program?
+5.6k Golang : Function as an argument type example
+8.5k Golang : How to capture return values from goroutines?