Step 1. Downloading PuTTY and PuTTYgen
To download, visit the official website. You can download the installer package in MSI (Windows Installer) format, which includes both PuTTY and PuTTYgen, or download them separately without the installer.
If you downloaded the PuTTY installer in MSI format, run it and follow the instructions displayed in the wizard.
Step 2. Generating Key Pair with PuTTY Key Generator (PuTTYgen)
Launch the PuTTYgen program from the list of programs, which you can find in the "Start" menu (Windows) or on the desktop if you've created a shortcut.
In the PuTTY Key Generator window, set the key type to RSA and the key length to 4096 instead of 2048 (Number of bits in a generated key). Then, click the Generate button to initiate the key pair generation process.
Move the mouse cursor within the program window to generate random numbers; this process typically takes a few seconds.

After key generation is complete, you will see information about the public key, including Key fingerprint and Key comment. You can modify the data in the Key comment field to make it more informative for your purposes.

Step 3. Password Protecting the Private Key (Optional)
If you wish to secure your private key with a password, enter it in the Key passphrase and Confirm passphrase fields. In this example, we will not explore this option.
Step 4. Saving the Keys
To save the public key, copy the contents of the Public key for pasting into OpenSSH authorized_keys file field and paste it into a separate text file, for example, myserver-ssh-key.pub.txt.
To save the private key, click the Save private key button. In the pop-up window, confirm that you want to save the private key without a passphrase, specify a file name (e.g., myserver-ssh-key), and the .ppk extension will be added automatically.
Step 5. Copying the Public Key to the Server
There are several options for copying the public key:
- Copying through connecting to the server via SSH or using the xterm.js console.
- Copying through the personal cabinet.
Let's consider each of these options.
1. Copying through connecting to the server via SSH or xterm.js console
Connect to the server using SSH or the xterm.js console located in the VPS control panel. Navigate to the home directory of the user for whom you want to enable SSH key login. All examples will be described for the root user.
Create the /root/.ssh folder and set permissions:
# mkdir -p /root/.ssh && chown root:root /root/.ssh && chmod 700 /root/.ssh
Create a file to store the public SSH key and set permissions:
# touch /root/.ssh/authorized_keys && chown root:root /root/.ssh/authorized_keys && chmod 600 /root/.ssh/authorized_keys
Open the file /root/.ssh/authorized_keys with a text editor:
# vi /root/.ssh/authorized_keys
Add the public key to the end of the file (contents from the myserver-ssh-key.pub.txt file). Ensure it is written on a single line and save with Esc, :wq, Enter.
ssh-rsa AAAAB3NzaC1yc2EAAAADAQAB... rsa-key-20231101
2. Copying through the control panel (Works only if qemu-guest-agent is installed on the VPS)
Go to the control panel, select the relevant VPS and click Manage. Scroll down to the information block and click the pencil icon in the top right corner.

In the opened modal window, enter the public key and save.

Note: This method works only if qemu-guest-agent is installed on the VPS.
Step 6. Connecting to the server using authentication keys
Launch PuTTY (putty.exe) and specify the private key for authentication. Go to Connection ⇒ SSH ⇒ Auth ⇒ Credentials, click Browse next to the Private key file for authentication field, and select the previously saved private key (myserver-ssh-key.ppk).

Specify the username by navigating to Connection ⇒ Data, and in the Auto-login username field, enter the username (e.g., root).

To save the session, go to the Session section, give it a name in Saved Session, enter the server IP address, specify the SSH port (default: 22), and click Save.

Click Open to connect. If connecting for the first time, accept the fingerprint warning. The console will open and login will occur automatically without a password.

