What is SSH?
SSH is the most used protocol for remote connections to servers. As SSH is text-only it does not need a high speed internet connection. This means you can almost always access your server from anywhere in the world.
In order to enable SSH connections to your server you'll be asked to configure an SSH key during the creation of your instance. In this article you'll read how to use this SSH key to connect to your server.
- An SSH client on your device
- An SSH key. You can read more about SSH keys in our article about SSH key pairs
- The floating (public) IP of the server
- The default username of the image
Using SSH on Linux or Mac
To connect to your server via your Linux or Mac computer you can use OpenSSH. This tool is installed by default in most Linux distributions and Mac OS.
Type the following command:
For example, if the server IP address is 192.168.1.1 and the default username "ubuntu", the command would look like this:
If you connect to a server for the first time, you'll be asked to confirm the identity of the server. SSH will use this confirmation to prevent man-in-the-middle attacks on future connections. Type "yes" to confirm the identity.
You're now connected to your server.
Using SSH on Windows
Windows does not have a SSH client by default. In order to use SSH on a Windows machine you can download Putty. Of course you are free to use any SSH client you want.
Creating a PKK file
Putty does not accept PEM files as a private key. To convert the PEM file you've received while creating the SSH key pair, use the program called "PuttyGen".
Load the “.pem” file from your local machine to show the converted SSH file. You can click on the “save private key” button, to save the file on your local machine.
Setting up Putty
After converting the PEM file to a PKK file, you can start setting up Putty. When Putty is started you will see the following screen:
Enter the IP of the server you want to connect to, and the port number (default: 22).
Setting the username
Now you need to enter the remote username to connect to the VM, in the “Connection-->Data”.
You can find the
Setting the SSH key
Before connecting you need to configure the private key Putty should use. In the menu, go to "Connection" => "Auth" and select the PKK file you have created earlier at the option "Private key for authentication".
Saving your session
If you save the session you can reconnect with just a few clicks. Go back to "Session", and enter a name under "Saved Sessions". For example, use the name of the instance. After that click "Save".
Connect to the instance
After this you can click on "Open" to connect to the server. If you connect to a server for the first time, you'll be asked to confirm the identity of the server. SSH will use this confirmation to prevent man-in-the-middle attacks on future connections. Type "yes" to confirm the identity.