Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect over ssh using a .pem file

Tags:

ssh

pem

I would like to know how to connect over SSH using a .pem file to any server.

Currently I'm executing the following command:

ssh [email protected]

What option should I use?

like image 508
danielrvt Avatar asked Oct 04 '22 11:10

danielrvt


2 Answers

Use the -i option:

ssh -i mykey.pem [email protected]

As noted in this answer, this file needs to have correct permissions set. The ssh man page says:

SSH will simply ignore a private key file if it is accessible by others.

You can change the permissions with this command:

chmod go= mykey.pem

That is, set permissions for group and others equal to the empty list of permissions.

like image 258
legoscia Avatar answered Oct 06 '22 23:10

legoscia


chmod 400 mykey.pem

ssh -i mykey.pem [email protected]

Will connect you over SSH using a .pem file to any server.

like image 60
shubham rajput Avatar answered Oct 07 '22 00:10

shubham rajput