Solution to the exception of PEM file logging in EC2

Logging in to EC2 will use

ssh -i <pem flie> [email protected]<EC2 Public DNS>

To log in. Here are two possible problems and solutions

PEM file permission problem. After typing the SSH command, the following error will be displayed

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for 'us.pem' are too open.

This can be solved by modifying the PEM file permissions.

chmod 600 us.pem

Request passphrase

After typing the SSH command, the system prompts as follows

Enter passphrase for key '/root/us.pem':

And no matter what text you enter, repeat the above prompt.

It was used in windows

Sublime text after opening the PEM file, copy the content to VI of Linux to generate the PEM file.

After that, we use Notepad of windows to open the PEM file, and then copy it to VI of Linux.


Read More: