Skip to main content

How to connect to an Elestio service with SSH keys

Connecting to an Elestio service Using Existing SSH Keys from a Mac/Linux Machine

Step 1: Check for Existing SSH Key Pair

First, verify if you have an existing SSH key pair by checking the .ssh directory. Open a terminal and execute the following command:

ls ~/.ssh

The file with the .pub extension is your public key.

If you don't have an existing SSH key pair, you can generate a new one using the following command:

ssh-keygen -b 4096 -t rsa

Step 2: Copy your SSH Public Key to your Elestio service

  1. Copy the Public Key to Clipboard:
    Navigate to the .ssh directory by typing

cd .ssh

Display the contents of your public key using cat. For example, if your public key is id_ed255518.pub, you can view it with:

cat ~/.ssh/id_ed255518.pub

Copy the displayed public key and add it to your Elestio service.

  1. Add the Public Key to Elestio:

    • Open your Elestio service and navigate to the 'Security' tab.

    • Go to 'Manage SSH Keys' and click on the 'Add key' button.

    • Paste your public key into the provided field.

Step 3: Confirm and Test Connection

To test the SSH connection to your VM, use the following command from your local machine:

ssh root@IPV4_TARGET_VM

Replace "IPV4_TARGET_VM" with the actual IPv4 address of your target VM, which you can find in the 'Overview' tab of your service.

For example:

ssh root@128.144.84.22

If the connection is successful, you'll be logged into your VM 🚀


Connecting to an Elestio service Using Existing SSH Keys from a Windows Machine with WSL (Windows Subsystem for Linux)

Step 1: Set up WSL (Windows Subsystem for Linux)

Before proceeding, you need to ensure that WSL is installed and configured on your Windows machine. Here's how you can set up WSL:

  1. Enable WSL: Open PowerShell as Administrator and run the following command:

    wsl --install

    This command will automatically enable the necessary features and install the latest version of WSL on your system.

  2. Install a Linux Distribution: After WSL is installed, visit the Microsoft Store and search for your preferred Linux distribution (e.g., Ubuntu). Click "Install" to download and install it.

  3. Initialize WSL: Once the distribution is installed, launch it from the Start menu. This will initialize the distribution and prompt you to create a user account and set up a password.

  4. Update and Upgrade: After the setup is complete, it's a good idea to update and upgrade the packages within your Linux distribution to ensure you have the latest versions. You can do this by running the following commands:

    sudo apt update sudo apt upgrade

    Follow the same tutorial to connect to an Elestio service using existing SSH keys from a Mac/Linux machine.