Two errors I faced when I tried to access EC2 with ssh. 【AWS】
Error 1
Feb 21, 2021
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
This error means that your pem file can be written and read by others. It is not good from a security point of view, so we have to protect the file.
The solution is like this.
chmod 600 to/your/pem/file/path
Error2
Load key "to/your/pem/file/path": invalid format
When this error shows up, you have to check out your pem file. There might be a wrong format in your file. In my case, the contents of the pem file are like below.
BEGIN RSA PRIVATE KEY
// key strings...END RSA PRIVATE KEY
However, it must be like this.
-----BEGIN RSA PRIVATE KEY-----
// key strings...-----END RSA PRIVATE KEY-----