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
+17.2k Golang : Check whether a network interface is up on your machine
+4.2k Responsive Google Adsense
+4.4k Golang : fmt.Println prints out empty data from struct
+8.8k Golang : Simple Jawi(Yawi) to Rumi(Latin/Romanize) converter
+20.4k Golang : Use TLS version 1.2 and enforce server security configuration over client
+8.8k Golang : Convert octal value to string to deal with leading zero problem
+19.8k Golang : Sort and reverse sort a slice of strings
+5.9k Golang : Fibonacci number generator examples
+5.2k Javascript : Generate random key with specific length
+9.5k Golang : Get UDP client IP address and differentiate clients by port number
+21.6k Golang : Gorilla mux routing example
+7.9k Golang : Inject/embed Javascript before sending out to browser example