Pregunta

Lets say I am given the ssh below.

ssh -i keypair.pem root@ec2-20-21-137-245.compute-1.amazonaws.com

I want to save it in /Users/UserName/Documents/ServerKeys

I believe I would add this to the ssh key

ssh -i ~/Documents/ServerKeys/keypair.pem root@ec2-20-21-137-245.compute-1.amazonaws.com

When I run this in the terminal I get

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/Users/UserName/Documents/ServerKeys/keypair.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: /Users/UserName/Documents/ServerKeys/keypair.pem
Permission denied (publickey).

Do I need to run chmod 400 keypair.pem at some point?

What I am I doing wrong and what else do I need to do to get into a server using the keypair?

¿Fue útil?

Solución

Yes, you should make sure the permissions on the file are secure. With a mode of 0644, anyone else on the system could read the key and use it to connect to the remote system. Setting it to 0600 ensure you and only you can read and write to the file (apart from root).

Otros consejos

Changing the permissions on your key to 600 should solve that particular error.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top