- Step 1 - Install PuTTY on your computer
- Step 2 - Generate the SSH key in PuTTYgen
- Step 3 - Save the key on your computer
- Step 4 - Create a new Cloud server
- Step 5 - Add the private key to PuTTY
- Step 6 - Start an SSH session in PuTTY
- Step 7 - Add the key to the PuTTY cache
- Step 8 - Connect to your server
In this guide we show you:
Note: This guide is for Windows users only.
- How to generate an SSH key pair with PuTTYgen on Windows,
- How to create a Cloud server with your own key.
- How to connect to your server with the SSH key in PuTTY.
What is an SSH key and why should you use it?
When you create a Cloud server you have the option to add your SSH key. You can use it instead of a password to log in to your server.
An SSH consist of a pair of 2 related keys; a private key that you keep on your computer and a public key that you can share. Something encrypted by the public key, can only be decrypted by the related private key, and vice versa.
When you connect to SSH, the server sends random text to your client, called "the challenge". The client uses your private key to encrypt this text and sends it back to the server. The server then uses your public key, that you stored there earlier, to decrypt the text again. If the text is the same as the one that was send you have proven your identity and authenticated yourself.
During this process, your private key has not left your computer. This makes it more secure than when you use a password, that you have to have to send to the server.
Step 1 - Install PuTTY on your computer
If you don't have PuTTY installed yet, start by doing this. You can download it here: http://www.putty.org
Step 2 - Generate the SSH key pair in PuTTYgen
Included with PuTTY is the PuTTY Key Generator that you need to generate the keys.
- Search your computer for PuTTYgen and open the program
- Set the parameters to RSA for key type and 2048 for number of bits, normally these are the default settings.
- Click Generate and start moving your mouse in the blank area. You can see the progress at the top of the screen.
Note: By moving the mouse over the blank area you create random data, that is used to create a completly unique set of keys.
Step 3 - Save the key on your computer
Once the key has been generated you need to save both the public key and the private key to a location on your computer.
We recommend that you add a passphrase for an extra layer of security. You will have to type it in every time you connect to your server with the SSH key.
- Type in a passphrase and confirm it by typing it in again.
- Click Save public key and save it as a txt file on a location on your computer.
- Click Save private key and save this on your computer as well, the private key is always saved as a ppk file.
Tip: Keep the public key at hand, you need it for the next step.
Step 4 - Create a new Cloud server
It is now time to create the Cloud server in the One.com control panel.
- Log in to the control panel and click Cloud server at the top of the screen.
- Select a server size and a server image.
- For SSH key, select New key.
- Type in a name for the key, for you to recognize it by.
- Paste the public key you just generated in the box.
- Click Add server all the way at the bottom.
Step 5 - Add the private key to PuTTY
In order to use PuTTY to log in with your SSH key, you need to let the program know where to find your private key.
- Open PuTTY on your computer.
- In the menu under Category, click SSH > AUTH.
- Click Browse and select the private key as the file for authentication.
Step 6 - Start an SSH session in PuTTY
The next step is to start a session in PuTTY and connect to your server.
- In the menu under Category, click Session and enter the following details:
- Hostname: the IP address of your Cloud server, you can find it in the control panel
- Port: 22
- Connection type: SSH
- Click Open.
Step 7 - Add the key to PuTTY cache
If it is the first time that you log in to this Cloud server, you need to confirm that you trust this host.
- Click Yes to add the server host key to the PuTTY cache. This is a different key than the SSH key.
Step 8 - Connect to your server
Everything is now in place for you to connect to your server.
- Type in the user name that you received via email and click enter.
- Type in the passphrase that you set earlier en click enter again.
You are now logged in and ready to go!