Monday, September 16, 2013

How to solve "WARNING: UNPROTECTED PRIVATE KEY FILE!" error

While trying to connect to a remote server using my private key, I got the below exception.


Warning: Permanently added '122.248.220.36' (ECDSA) to the list of known hosts. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0664 for 'evanthika.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: evanthika.pem
Permission denied (publickey).



To solve this, run the below command from the place that you have you .pem file

chmod 0400 evanthika.pem