Linux – How to access an AWS instance from another PC

How to access an AWS instance from another PC… here is a solution to the problem.

How to access an AWS instance from another PC

I have an AWS Linux instance with a LinuxDemo.pem key. I can access it from my own workstation, no problem. However, if I try to access it from home, or if another colleague tries to access it, we get the following result;

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for 'LinuxDemo.pem' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: LinuxDemo.pem
Enter passphrase for key 'LinuxDemo.pem':
Permission denied (publickey).

Now run the same command on all workstations – ssh -i LinuxDemo.pem ec2-user@<IP_Address>

How can I make this instance accessible to others because it’s important.

Solution

You need to change the permissions of the PEM key on other computers:

chmod 0400 LinuxDemo.pem

See also Trying to SSH into an Amazon Ec2 instance – permission error

Related Problems and Solutions