Two errors I faced when I tried to access EC2 with ssh. 【AWS】

Error 1

--

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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-----

My LinkedIn account

--

--

Tomoharu Tsutsumi
Tomoharu Tsutsumi

Written by Tomoharu Tsutsumi

5+ years Full Stack SWE (Ruby, Go, TypeScript, JavaScript) | Former Founding Engineer of AI Startup in Canada

No responses yet