Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ssh into Amazon Lightsail without Putty

Amazon Lightsail gives directions on how to ssh into your instance from putty, but not from ordinary ssh. How would you ssh in from MacOS or Linux?

like image 673
James Shapiro Avatar asked Oct 13 '17 03:10

James Shapiro


2 Answers

Here's how I did it on MacOS:

(1.) Go to Account page to download the default private key

(2.) Set the permissions of the private key to be more restrictive (AWS will refuse to let you ssh with the default permission)

$ chmod 400 LightsailDefaultPrivateKey-us-west-2.pem

worked for me.

(3.) Finally, ssh into your lightsail instance. You will need the ip address for your lightsail instance, which you can get from the Amazon Lightsail frontpage.

ssh -i "LightsailDefaultPrivateKey-us-west-2.pem" ubuntu@[ip-of-lightsail-instance]

worked for me.

like image 178
James Shapiro Avatar answered Nov 17 '22 02:11

James Shapiro


I lost time trying to get this to work. The keys AWS provided just didn't work. What finally did work was logging in from the browser-based terminal and adding my public RSA key to the authorized_keys file on the Lightsail instance.

Direction from Mac console:

cat .ssh/id_rsa_pub Select the text carefully so you have it all on your clipboard and nothing extra.

In the browser-based termianl session with your lightsail instance, cd .ssh cp authorized_keys autorized_keys.bak vim id_rsa_pub go into insert mode by typing i Paste the contents on your clipboard from your id_rsa_pub :wq

That's it. Now go back to your console. ssh bitnami@ < your AWS public IP address>

Enter your passphrase if you set one when creating your RSA keys and are prompted for it.

If you haven't created your RSA keys yet, check on the ssh-keygen tool.

like image 43
Jack Mason Avatar answered Nov 17 '22 03:11

Jack Mason