PuTTY is an open source software which implements SSH and Telnet for Windows and Unix platforms, along with an xterm terminal emulator.

This is guide is intended for Ubuntu or Debian users who want to setup access to their server via SSH in a fast and secured manner.


Ensure that you have everything required from the below list before starting the process.
A non-root user with sudo privilleges and password authentication enabled.
putty.exe and puttygen.exe applications for your operating system which can be installed from here.

Generating SSH keys

Open PuTTY gen tool

Parameters section:
Select RSA for the type of key
Change number of bits to 4096

Click the Generate button

Move your cursor in the blank space to generate randomness until the bar is full and your key has been generated.

Key section:
In Key comment, enter a description of your liking to identify your key in the future. Ex: Office computer
Optional: In Key passphrase and Confirm passphrase enter the same passphrase that you want to use.

Click Save public key button, enter a filename of your choice and save it in a directory.

Click Save private key button, enter a filename of your choice and save it in a directory.

Save both your keys in a safe directory that only you can access.

Saving the public key on the server

Open PuTTY client tool

For connection type select SSH

In the hostname box enter your details in the following format: user@address

In port box enter 22 which is the default port.

Click the open button at the bottom of the application.

Enter your user's password when requested.

If your SSH directory does not exist, you can create it manually by pasting (right-click) the following commands into your PuTTY client.
mkdir ~/.ssh
chmod 0700 ~/.ssh
touch ~/.ssh/authorized_keys
chmod 0644 ~/.ssh/authorized_keys

Obtain your public key from PuTTY gen by selecting all text and copying it to your clipboard like so. It should begin with "ssh-rsa AAAA"

Enter the file that we created earlier in your PuTTY client using the command:
sudo nano ~/.ssh/authorized_keys

Paste (right-click) the SSH public key into the file like so.

Save your file and close it, using the commands below:
Press Ctrl + O (Save)
Press Enter (Confirmation)
Press Ctrl + X (Exit)

Close the PuTTY gen and client application.

Creating a PuTTY profile

Open a new session of PuTTY client.

On the left side of the window navigate to the Connections category, select SSH, press the drop-down button and select Auth like so.

Press the browse button and select your private key which should be in a .ppk format.

Navigate back to your Sessions category

Enter your hostname details. Ex: user@address

Enter your port (22 is default) and select your connection type as SSH

In saved sessions enter a name for your session which would be useful to identify your connections. Ex: RBNO VPS

Press the save button. You should be able to see your session's name under "default settings"

Double-click your saved session to open a connection. If you configured everything correctly you will enter your server without being prompted to type your user's password.
Note: If you set a passphrase for your SSH key you will be asked to type that.

Disabling Password Logins (OPTIONAL)

If you are successfully able to make connections with your SSH keys and not by entering your user's password, you can disable password login to add an extra layer of security.
If your password authentication is disabled and you lose the keys, you will not be able to access your server. Do it at your own risk.

Open your server's configuration file by entering the command:
sudo nano /etc/ssh/sshd_config

Edit the lines in your file so it is reflected like below:
PasswordAuthentication no
UsePAM no

Save your file and close it, using the commands below:
Press Ctrl + O (Save)
Press Enter (Confirmation)
Press Ctrl + X (Exit)

Reload your SSH server configuration by entering the below command:
sudo systemctl reload ssh
Was this article helpful?
Thank you!