Learn how to use PuTTY for secured connections to your OVHcloud service via the SSH protocol.
PuTTY is an open-source SSH client software with a graphical user interface. It was developed for Windows but is available for other operating systems as well and includes useful features, such as SSH key management.
Requirements
- PuTTY installed on your local device
- A basic understanding of the SSH protocol and its usage
- Access to the OVHcloud Control Panel
This tutorial is designed to help you as much as possible with common tasks. If you are having difficulty performing these actions, please contact a specialized service provider. OVHcloud can't provide you with technical support in this regard.
Instructions
Content overview
- Installing PuTTY
- SSH connections with username and password
- SSH connections with username and SSH key authentication
- Using PuTTY connection sessions
- Use case example: How to use PuTTY tools to configure secure connections to OVHcloud servers (VPS, dedicated server, Public Cloud instance)
Installing PuTTY
Download the latest release version of the PuTTY client from the official website and install it on your system (or extract the executable files). Ported versions of PuTTY might also be available via your software package manager or Homebrew.
The recommended standard installation package includes several applications that enhance the functionality of PuTTY, namely for file transfers (psftp
, pscp
, not covered in this tutorial) and SSH key management (PuTTYgen
, Pageant
, required for the corresponding parts below).
The following instructions are based on a Windows operating system. The functionality of the PuTTY software itself should be consistent across operating systems. However, if you are not using PuTTY on a Windows device, you may need to consult the documentation of your operating system or the official FAQ and documentation of PuTTY.
You can have multiple instances of PuTTY and its companion tools opened simultaneously. For example, you can open one window to follow the tutorial steps and a second one to test connections.
SSH connections with PuTTY - Username and password
This section explains how to establish a first SSH connection to the following OVHcloud services:
Dedicated server or VPS
You will need the IP address of your server which you can find in the OVHcloud Control Panel and the name of the user account you want to use for this login session. Consult our "Getting started" guides if you require further details on this topic:
How to connect to a remote host
Open PuTTY and enter the login credentials into the appropriate fields.
-
Host Name (or IP address)
: username@IPv4_server (example: ubuntu@203.0.113.101) -
Port
: 22 (unless you have changed the SSH port number of your server)
Click Open
.
At the first connection, the "PuTTY Security Alert" window will appear, informing you about possible risks. This is usually not a concern, as long as you are connecting to a trusted host (such as your own secured server).
Click Accept
to proceed. If you select Connect Once
, the server's fingerprint will not be saved to the cache and the alert will show up again at the next connection. You can find further details in our SSH introduction.
The command line window (PuTTY terminal) will open and prompt you to enter the user account's password. You can paste the password string into this window with a right-click.
Note that a password prompt will not display your keyboard inputs in a PuTTY terminal. Example output:
You can learn more about SSH connections in our SSH introduction.
PuTTY can save the parameters of an SSH connection as a "session". This allows you to connect to known remote hosts or local network devices without entering their respective details each time. Learn how to use PuTTY sessions in the corresponding section of this tutorial.
SSH connections with PuTTY - Username and authentication key (SSH key files)
This part of the tutorial explains how to use SSH with key pair authentication in PuTTY to connect to the following OVHcloud services:
You will need the IP address of your server which you can find in the OVHcloud Control Panel and the name of the user account you want to use for this login session. Consult our "Getting started" guides if you require further details on this topic:
PuTTY stores key files in a specific format which makes them incompatible with SSH key files created with the OpenSSH client. If you want to use a private key previously created with the command line SSH client (e.g., for a server or a Public Cloud instance), you will need to convert it to the PuTTY format first.
Creating SSH keys (PuTTY key generator)
This step requires the PuTTY companion tool PuTTY key generator (PuTTYgen).
How to create SSH keys with PuTTYgen
Open the PuTTYgen application and select the encryption algorithm. This example uses RSA. Enter "4096" into the field Number of bits in a generated key:
at the bottom.
Click Generate
.
A progress bar will appear. Move your mouse cursor about the area below the progress bar until PuTTYgen has enough randomized data to start generating your key.
You now have a key pair, consisting of two elements:
- Public key: The key string that will be stored on the remote host(s) to which you want to connect.
- Private key: The key string that remains on the local device from which you connect to a remote host (or several).
You can optionally edit the field Comment
with your own description. It will be displayed by PuTTY tools when using the key.
Enter a passphrase to protect your private key file into the fields Key passphrase
and Confirm
. The best practice approach is to use a password manager to create and store a password consisting of multiple words (passphrase).
Click on the button Save private key
. Select a folder for your key files or create a new one, named putty_key_files
for example.
Enter a name for your file and save it. You should now have a new private key file with the extension ppk
(PuTTY private key) in your folder.
NOTE: Access to remote servers is only as secure as the client device storing the private key. Protecting your device and the key files stored on it from unauthorized access is therefore crucial.
For increased convenience, store passphrases in a password manager on your device, such as the open-source solution KeePass, and use the Pageant tool for key-based connections.
The button Save public key
in the PuTTYgen interface will convert the public key string into the "SSH-2 standard format" and then create a file containing this string. Key strings of that format however are not relevant for this tutorial.
The next step will be to store the public key on the remote host to which you want to connect. The format of the key string as it is displayed in the PuTTYgen window under Public key for pasting into OpenSSH authorized_keys file
is compatible with OpenSSH. You will need the exact key string as one line.
There is no need to store the public key as a file since you can always retrieve it from the private key file. To do this, open PuTTYgen and click on the button Load
. Select your ppk
key file and enter your passphrase to open it.
Alternatively, you can copy the public key string and paste it into a plain text file (without interrupting the key string with line breaks).
To follow up with the next step, be sure to highlight the entire key string and copy it.
Transferring public SSH keys to your server
The actions in this step depend on the type of service you are using and whether you are going to install a new operating system or add the key to a system that is in use.
How to add a public SSH key when installing or reinstalling an OS (OVHcloud Control Panel)
Click on the tab for your service:
Highlight and copy the entire public key string you have created in the previous step from the PuTTYgen window. (Open the corresponding private key file first if necessary.) Then use it as instructed in the corresponding section of our guide on how to create a Public Cloud instance in the OVHcloud Control Panel.
Highlight and copy the entire public key string you have created in the previous step from the PuTTYgen window. (Open the corresponding private key file first if necessary.) Then enter it into the appropriate field during the installation process. You can find the details in our guide on how to get started with a dedicated server.
Highlight and copy the entire public key string you have created in the previous step from the PuTTYgen window. (Open the corresponding private key file first if necessary.) Then enter it into the appropriate field during the installation process. You can find the details in our guide on how to get started with a VPS.
How to add a public SSH key on a running OS
Highlight and copy the entire public key string you have created in the previous step from the PuTTYgen window. (Open the corresponding private key file first if necessary.) Then follow the instructions in the appropriate guide:
- How to configure additional SSH keys on an instance
- How to replace an SSH key pair on a Public Cloud instance
Connect to your server with the user account concerned. Create the folder .ssh
(if it does not exist):
To store the key for the current user, open (or create) the file authorized_keys
with your preferred text editor (nano
is used in this example):
Highlight and copy the entire public key string you have created in the previous step from the PuTTYgen window. (Open the corresponding private key file first if necessary.)
NOTE: Paste your the entire public key string into this file. Ensure that the key string is still uninterrupted, with no line breaks.
Save the file and exit the editor. Reboot your server (sudo reboot
) or only restart the OpenSSH service with one of the following commands (the appropriate command may vary depending on your OS):
Quit the current PuTTY session:
To verify that your key is set up properly, connect to your server by following the steps described below.
Connecting to your server
In order to connect to a remote host (Public Cloud instance, dedicated server or VPS), you need to have created the key pair and added the public key string to your server.
- Open PuTTY.
- Expand the node
SSH
underConnection
in theCategory
tree. - Expand the node
Auth
. - Click
Credentials
to see the corresponding settings. - Click the button
Browse
. - Select the private key file (
keyfile.ppk
) from the folder in which you have saved it.
Navigate back to Session
in the left-hand menu. Enter the login credentials into the appropriate fields.
-
Host Name (or IP address)
: username@IPv4_server (example: ubuntu@203.0.113.101) -
Port
: 22 (unless you have changed the SSH port number of your server)
Click the button Open
.
The PuTTY terminal will prompt you for the password of the key file. You can paste the password string into this window with a right-click.
Note that a password prompt will not display your keyboard inputs in a PuTTY terminal. Example output:
For a more convenient process, find out how to associate a key file with Pageant and save this connection in the sections below.
Managing SSH keys on a local device with Pageant (PuTTY authentication agent)
If you have followed the instructions above, you can access your remote host via key authentication. While the connection itself does not require a password, PuTTY will still ask for the password of the corresponding private key file.
Using Pageant enables faster connections in two ways:
- You do not need to select the private key file for each connection in PuTTY.
- You only need to enter the passphrase for the private key file once, when the key file is opened by Pageant.
Open the Pageant application on your device. Since the Pageant key window will not open automatically, you need to (double-)click on its icon in your taskbar ("system tray" in Windows).
This will open the Pageant Key List. Click the button Add Key
, and select the private key file (keyfile.ppk
) from the folder in which you have saved it.
Enter the passphrase for this key file. The key is now on the list and will be used by PuTTY as long as Pageant is running.
Even if you close this window, Pageant will continue to run in the background. It will function as long as the icon is present in the taskbar.
If you also save your connection as a session in PuTTY as described in the following section, you will be able to open remote connections with only a few clicks.
Using PuTTY connection sessions
PuTTY has the ability to store parameters for different connections as sessions, enabling you to establish a connection to the destination host (web hosting, server, instance, local network device) faster.
Select the relevant connection method:
Login with username and password
To store a password-based connection session, carry out the following actions:
1. Open PuTTY.
2. Enter the connection details into the field under Host Name (or IP address)
: username@IPv4_server (example: ubuntu@203.0.113.101)
3. If relevant, edit the SSH port number in the field under Port
.
4. Enter a name for this connection into the field under Saved Sessions
.
5. Click the button Save
.
To open a connection saved previously, carry out the following actions:
1. Open PuTTY.
2. Double-click the desired session in the list under Saved Sessions
or select it and click the button Open
.
In the PuTTY terminal window, enter the user password of the remote host.
Login with username and authentication keys
To store a key-based connection session, carry out the following actions:
1. Open PuTTY.
2. Enter the connection details into the field under Host Name (or IP address)
: username@IPv4_server (example: ubuntu@203.0.113.101)
3. If relevant, edit the SSH port number in the field under Port
.
4. Expand the node SSH
under Connection
in the Category
tree.
5. Expand the node Auth
in the Category
tree.
6. Click Credentials
to see the corresponding settings.
7. Click the button Browse
.
8. Navigate to the folder that stores your private key files.
9. Open the key file concerned.
10. Go back to the configuration category Session
in the menu on the left.
11. Enter a name for this connection into the field under Saved Sessions
.
12. Click the button Save
.
You can now open any previously saved key-based connection quickly from the PuTTY window or via Pageant:
1. Open PuTTY.
2. Double-click the desired session in the list under Saved Sessions
.
1. Right-click the icon of Pageant in the taskbar.
2. Click the desired session from the submenu Saved Sessions
.
To edit the parameters of a session, select it from the list and click the button Load
.
Use case example: How to use PuTTY tools to configure secure connections to OVHcloud servers (VPS, dedicated server, Public Cloud instance)
This tutorial can be applied to various scenarios and different types of connections.
By following these steps in order, you can configure your connections so that they can be opened with a few clicks:
- Step 1: Install the PuTTY package
- Step 2: Create a key pair in PuTTYgen
- Step 3: Add the public key to your remote host
- Step 4: Add the private key to Pageant
- Step 5: Save the connection as a session in PuTTY
- Step 6: Connect to your remote host via the corresponding saved session
Go further
How to create SSH keys with OpenSSH
How to create SSH keys with OpenSSH for Public Cloud instances
For more information and tutorials, please see our other Public Cloud support guides or explore the guides for other OVHcloud products and services.
If you need training or technical assistance to implement our solutions, contact your sales representative or click on this link to get a quote and ask our Professional Services experts for a custom analysis of your project.