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.
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.
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.
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.
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.
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.
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.
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.
To simplify the SSH command, you can set up an SSH configuration file.
Edit or create the SSH config file:
nano ~/.ssh/config
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.
Save and exit the file.
Connect to your server using:
ssh [MY_SERVER]
Replace [MY_SERVER] with the name that was used in the config file.
Open PowerShell or Command Prompt.
Edit or create the SSH config file:
notepad $HOME\.ssh\config
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.
Save and close the file.
Connect to your server using:
ssh [MY_SERVER]
Replace [MY_SERVER] with the name that was used in the config file.
© Copyright 2024. Make Life Great LLC. All rights reserved.