SSH key authentication in PuTTY

1) Generating keys on Linux

Run the ssh-keygen utility. It asks you where to save the keys and asks you to set a password (you can do it without a password).

ssh-keygen


Now we have two keys that were saved in the .ssh directory: id_rsa - the private key and id_rsa.pub - the public key
The keys look like text. This makes them easy to view, copy and paste into the desired file.

cat /root/.ssh/id_rsa
cat /root/.ssh/id_rsa.pub

Go to the .ssh folder

cd /root/.ssh

Let's write our key to the desired file

cat id_rsa.pub > authorized_keys

Changing the rights to the file

chmod -c 0600 id_rsa

2) Authorization to the server using PuTTY

On the server, run the command

cat /root/.ssh/id_rsa

Copy the contents of the key, paste it into notepad and save it with the *.ppk extension
Open PuTTY Key Generator and load our key with "Load" button

Save our key, agree to create without a password
(If you have set a password on the keys in step 1, specify this password)

Next, open the PuTTY client. As usual, in the main window specify where we connect, and on the left side select "Connection → SSH -> Auth", in the window select our key

Connect, login to the server, get to the server without a password

In PuTTY, you can also specify a login right away.
Go to "Connection → Data" and in the "username" field of the "Auto-login" section, specify the login for the session.