UNPROTECTED PRIVATE KEY FILE!

If you are are attempting to connect to your AWS EC2 instance (or another running container) for the first time, via SSH, you might encounter an error trying to connect to it using your private key (PEM) file. Here’s a quick fix to that “WARNING: UNPROTECTED PRIVATE KEY FILE!”

Warning: Unprotected Private Key File screenshot

In your console, you simply need to run the following to fix this issue:

sudo chmod 400 ~/path/to/your/<private-key-file>.pem

This removes all other permissions to your file except for the READ permission.

But why is this required? This makes sure that your private key is protected from inadvertently (or maliciously) being modified by any user other than your root user. This

Share: