Guide to Accessing Your Server Using SSH

Introduction

One of the most common ways to access your server is through a terminal using SSH. This guide will help you to do this on Windows, macOS, and Linux.

You created an SSH private key when you created server. If this is not the first server that you created, will reused the SSH private key that was created initially.

NOTE: Each time you "Start" your server, it will be given a new IP address. Make sure that you use the current IP address when connecting to your server using SSH.

Windows

Using OpenSSH (Windows 10 and Later)

  1. Verify OpenSSH Client Installation:

    The OpenSSH client is included in Windows 10 and later. To verify this, open PowerShell and run:

    ssh -V
    

    If you see version information, OpenSSH is installed.

    If you DO NOT see version information, follow the steps below.

    1. Open Windows Settings
    2. Select "System"
    3. Select "Optional features"
    4. Click on Add an optional feature "View features"
    5. Search for and select "OpenSSH Client"
    6. Click "Install"
  2. Connect to Your Server:

    ssh -i [PATH_TO_KEY_FILE] root@[SERVER_IP_ADDRESS]
    

    Replace [PATH_TO_KEY_FILE] with the full path including file name for your SSH private key file and [SERVER_IP_ADDRESS] with the IP address for the server from your dashboard.

macOS

  1. Set the Correct Permissions: For the SSH private key file.

    Open the Terminal application (Applications > Utilities > Terminal).

    chmod 600 [PATH_TO_KEY_FILE]
    

    Replace [PATH_TO_KEY_FILE] with the full path including file name for your SSH private key file.

  2. Connect to Your Server:

    ssh -i [PATH_TO_KEY_FILE] root@[SERVER_IP_ADDRESS]
    

    Replace [PATH_TO_KEY_FILE] with the full path including file name for your SSH private key file and [SERVER_IP_ADDRESS] with the IP address for the server from your dashboard.

Linux

  1. Set the Correct Permissions: For the SSH private key file.

    chmod 600 [PATH_TO_KEY_FILE]
    

    Replace [PATH_TO_KEY_FILE] with the full path including file name for your SSH private key file.

  2. Connect to Your Server:

    ssh -i [PATH_TO_KEY_FILE] root@[SERVER_IP_ADDRESS]
    

    Replace [PATH_TO_KEY_FILE] with the full path including file name for your SSH private key file and [SERVER_IP_ADDRESS] with the IP address for the server from your dashboard.

Warning When Connecting

When you SSH into the server for the first time (first time connecting at a specific IP address), you will see roughly the following message and be required to respond to the questions.

The authenticity of host '[SERVER_IP_ADDRESS] ([SERVER_IP_ADDRESS])' can't be established.

ED25519 key fingerprint is [SERVER_FINGERPRINT].

This key is not known by any other names

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

Warning: Permanently added '108.61.39.103' (ED25519) to the list of known hosts.

This message indicates that you are connecting to a server for the first time, and the server's public key is not yet known to your computer. The public key is used to verify the authenticity of the server, and to ensure that you are not being tricked into connecting to a malicious server.

You are being asked to confirm that you want to continue connecting to this server.

If you are sure that you want to continue connecting, you can type "yes". This will add the server's public key to your list of known hosts, and you will not be prompted again in the future - while the server is using this IP address.

You will see this again after stopping and restarting the server as it will be assigned a new IP address.

It is important to note that this warning is only a security measure. It does not mean that the server is malicious. However, it is always a good idea to be cautious when connecting to unknown servers.

Setting Up SSH Config File (Optional)

To simplify the SSH command, you can set up an SSH configuration file.

macOS and Linux

  1. Edit or create the SSH config file:

    nano ~/.ssh/config
    
  2. Add the following configuration:

    Host [MY_SERVER]
      HostName [SERVER_IP_ADDRESS]
      User root
      IdentityFile [PATH_TO_KEY_FILE]
    

    Replace [MY_SERVER] with a meaningful name, [PATH_TO_KEY_FILE] with the full path including file name for your SSH private key file, and [SERVER_IP_ADDRESS] with the IP address for the server from your dashboard.

  3. Save and exit the file.

  4. Connect to your server using:

    ssh [MY_SERVER]
    

    Replace [MY_SERVER] with the name that was used in the config file.

Windows

  1. Open PowerShell or Command Prompt.

  2. Edit or create the SSH config file:

    notepad $HOME\.ssh\config
    
  3. Add the following configuration:

    Host [MY_SERVER]
      HostName [SERVER_IP_ADDRESS]
      User root
      IdentityFile [PATH_TO_KEY_FILE]
    

    Replace [MY_SERVER] with a meaningful name, [PATH_TO_KEY_FILE] with the full path including file name for your SSH private key file, and [SERVER_IP_ADDRESS] with the IP address for the server from your dashboard.

  4. Save and close the file.

  5. Connect to your server using:

    ssh [MY_SERVER]
    

    Replace [MY_SERVER] with the name that was used in the config file.

Troubleshooting

Security Recommendations

Logo

© Copyright 2024. Make Life Great LLC. All rights reserved.

FacebookFeedTwitter