How to use SSH to connect to an Instance

Secure Shell or SSH is a protocol that allows you to connect to Instances (Linux machines). Using SSH, you can access/interact with your Instance securely since the connection is highly encrypted.

Prerequisites

  • A running Instance IP address.

  • Username of the server.

  • Password for the username if you are not using SSH keys.

  • Firewall settings should allow the remote connection.

An SSH key is a combination of the private key and public key. The Private key is only known to you and is located on the client machine. In contrast, the Public key can be shared with anyone or used on any server you want to access.

There are two ways to connect to an Instance.

  1. Connect with OpenSSH
  2. Connect with PuTTY


Connect with OpenSSH

OpenSSH is included on Linux, macOS, and Windows Subsystem for Linux. You need to use a terminal on a Linux, macOS, or Windows computer to connect to your Instances with SSH.

To connect to the Remote Desktop via SSH, follow the steps below:

  1. Open the terminal and use the following command and enter the IP address of an Instance.

    ssh [email protected]
    Note: For most of the operating systems (Ubuntu and CentOS), the username is root.

  2. Note: We are trying to ssh to a remote Instance having an IP address as 203.0.113.0 and username as root.

  3. When you login the first time, the server isn’t identified on your local machine, so you will be prompted with the following message:

    The authenticity of host '203.0.113.0 (203.0.113.0)' can't be established.
    ECDSA key fingerprint is
    SHA256:IcLk6dLi+0yTOB6d7x1GMgExamplewZ2BuMn5/I5Jvo.

  4. Type yes and then press ENTER to continue.

    Are you sure you want to continue connecting (yes/no)? yes

  5. As a host key is saved to your local machine, you will receive the following confirmation:

    Warning: Permanently added '203.0.113.0' (ECDSA) to the list of known hosts

  6. In the authentication process, you will be connected to your Instance instantly if you already have added SSH keys.

  7. In case you didn’t add your SSH keys, you will be asked for your password with the following command:

    [email protected]'s password:
  8. Enter the Password press ENTER.



Connect with PuTTY

PuTTY is a widely used open-source software SSH and Telnet client for Windows that lets you connect to your remote computers/instances from your local machine (Windows computer). You need to have PuTTY installed on your local machine.

If you don’t have PuTTY installed, refer to its official website to download it.

To connect to the Instance via PuTTY, follow the steps below:

  1. Launch the PuTTY and enter the IP address of an Instance.

  2. Check its port (it should be 22 by default) and Connection type should be SSH.

  3. Click Open

  4. Click SSH under Connection in the left sidebar and check 2 is selected for SSH protocol version.

  5. A message will prompt you to enter your username, enter username root, and press Enter.

  6. Enter your Password press ENTER.

You are now successfully connected to your Instance with the PuTTY client.

Connect to Instance using SSH keys via PuTTY

This guide considers that you have uploaded the public key to your account and specified the key while creating an Instance.

To connect to Instance using SSH keys, follow the steps below:

  1. Double-click SSH under Connection in the left sidebar and open Auth.

  2. In the RHS Private key file for authentication section, click Browse.

  3. Search for a private key file that ends with .ppk and click open.

  4. Click Data under Connection in the left sidebar and enter your Instance’s username in Auto-login username root.

  5. Click Session in the left sidebar and enter the name in the text box under Saved Sessions.

  6. Click Save.

As your changes are saved, you will be connected to your Instance.