How to connect the Lightsail with SSH from Linux

Case 1: If you already have your private and public key, and your don’t want to change the key

1. Uploading the SSH key pairs

1. In your local computer

  1. # cd /User/YourUserName/.ssh/

2. In the browser of your local computer

  1. Account -> SSH Keys -> Upload New
  2. upload the id_rsa.pub
  3. Set up the “id_rsa” as your SSH Key

3. Copy the content of id_rsa.pub in your local Computer

  1. # vim id_rsa.pub
  2. copy the content

2. Edit the Server

  1. # sudo su
  2. # cd ~/.ssh/
  3. # ls
  4. # rm authorized_keys
  5. # vim authorized_keys
  6. copy the content of id_rsa.pub to authorized_keys
  7. chmod 600 ~/.ssh/authorized_keys
  8. # ssh-keyscan -t rsa your_ip_address
  9. copy the rsa’s content of your server

3. Edit the “known_hosts” in your local computer

  1. paste the rsa content to the known_hosts

4. Connect the Serve by SSh

  1. # ssh username@your_ip_address

Case 2: Already upload your SSH Key before creating the instance

1. In the server

  1. # ssh-keyscan -t rsa your_ip_address
  2. copy the rsa’s content of your server

2. Edit the “known_hosts” in your local computer

  1. paste the rsa content to the known_hosts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.