You can log in to the Windows server console on the hosting remotely without using a password. To do this, use the SSH authentication method using RSA keys. This method is more convenient to use and also safer.

This article describes the setup procedure when connecting from a Windows computer using the PuTTY client.

To configure this authentication method, you should do the following steps:

  • Download and install the PuTTY client for your OS version

  • Create a .ssh folder in the home folder of the current Windows user.

For example, c:\Users\user\.ssh

  • Run the puttygen utility, which is included in the installation kit PuTTY.

Microsoft Windows [Version 10.0.14393]
(c) Корпорация Майкрософт (Microsoft Corporation), 2016. Все права защищены.

C:\Users\user>puttygen

  • In the utility window, click the Generate button

8.SSH access to the server using keys (for Windows)

  • Next, you need to spend the mouse a few random movements over the utility window to randomize the generator until the key is generated.

10.SSH access to the server using keys (for Windows)

  • When the key is generated, click the Save private key button in the window.

12.SSH access to the server using keys (for Windows)

  • The offer to save the file without additional password protection can be confirmed.

14.SSH access to the server using keys (for Windows)

  • Save the file to the folder (created earlier) c:\Users\user\.ssh named id_rsa.ppk

16.SSH access to the server using keys (for Windows)

Attention! The private key file must be protected from unauthorized access. Make sure that this file is not compromised

Next, you need to transfer the contents of the public key to the file /root/.ssh/authrized_keys of the server on the hosting.

  • To do this, first copy the contents of the public key to the clipboard
19.SSH access to the server using keys (for Windows)

  • Run the PuTTY utility

Microsoft Windows [Version 10.0.19043.1165]
(c) Корпорация Майкрософт (Microsoft Corporation). Все права защищены.

C:\Users\user>putty

  • Enter the IP address of the server on the hosting, the root login and the password that was received when activating the service

23.SSH access to the server using keys (for Windows)

Next, in the Linux server console, execute several commands sequentially:

  • Create a folder ~/.ssh (if it doesn't exist)

[root@server ~]# mkdir ~/.ssh

  • Assign permissions for the folder

[root@server ~]# chmod 700 ~/.ssh/

Add the public key to the file ~/.ssh/authorized_keys, paste the contents of the public key copied earlier to the clipboard into the argument of the echo command (in quotes)

[root@server ~]# echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCLLeYgfHbOb4u3aaFooFr6i+orBeHVIn3zBn2AnGVUu/e95su7o7M5O3Fs5bUkrevqaaZq39BvMpPRgBmL/D8C+ea27YP5zpz+Z2iQbjIS6zYI5S1j/9oKXo2tvW1A/nbciaRTXnxwXc0OLYIkzMZzJclUqz5fP5lnw2F4hsq9karkRd1Fs+T6JmVquarpsZqBS7jf4MooIdCST2NByQ3xM8EacWFZ0CzRG6iH0m6hFlOnFtEI9oHDIAA+i9pyHd9XgoRe9zw9KPaNBQBknisOjO2deCu1ymOTD9lfqHE" >>~/.ssh/authorized_keys

  • Apply strong access rights to the file

[root@server ~]# chmod 600 ~/.ssh/authorized_keys

  • Next, run the pageant utility (PuTTY Authentication Agent) from the PuTTY installation kit on your computer

Microsoft Windows [Version 10.0.14393]
(c) Корпорация Майкрософт (Microsoft Corporation), 2016. Все права защищены.

C:\Users\user>pageant

The icon of the running PuTTY agent will be displayed in the system tray.

  • Double click on it and add the previously created private key from the file c:\Users\user\.ssh\id_rsa.ppk
36.SSH access to the server using keys (for Windows)
37.SSH access to the server using keys (for Windows)

  • If everything went well, then the procedure for connecting passwordless SSH key authentication is completed. You can run the PuTTY utility. And while the agent with the connected private key is running in the system tray, the login to the remote server on the hosting will be performed transparently without entering a password.

To configure SSH connection for Linux (MacOS), see the Knowledge Base article