This article will describe the process of authorization key in the putty to ssh-session.
This is done in order not to introduce a permanent password.
The first step is a set of utilities downloaded Putty. We need PuTTY.exe, puttygen.exe, PSFTP.exe, Pageant.exe
Open puttygen.exe. There will be key generation.
Select “key type for generating” – SSH-2 RSA, key strength – 2048. Hit generate. See the following:
Key comment / Comment – enter a comment to the key.
Key passphrase / passphrase – passphrase to the private key. It must be entered when connecting or stored in a memory Pageant.exe. You can leave blank.
Confirm passphrase – confirm the passphrase.
Next, save the public key and a private key. Private key should be stored in a secluded place, and the public key will need to throw the remote server, which set up authorization. To do this, you can use any convenient means to you. This article will use the kit PSFTP putty.
Run PSFTP.exe. Login to your server:
psftp> open 126.96.36.199
Login and password as well as from ssh.
Copy the public key to the server to any folder:
psftp> put H: /ssh-keys/private_key_name.pub /root/private_key_name.pub
Since the key was created in putty, then it must be “converted” into a format understandable linux or freebsd. At the same time re-save the keys in the right place.
Login to the server with ssh.
Go to the directory where you copied the key and run the command:
# Ssh-keygen -i -f /root/private_key_name.pub >> /root/.ssh/authorized_keys
If the folder .ssh not, create it with the rights 700. All the files in this folder should have the right to 600.
SSH-daemon should automatically pick up all these things, now move on to configuring Putty.
Open Putty, enter the settings for connecting to the server (address, port, session name), go to the tab SSH-based authentication:
Specify the path to the private key.
Go back to the session setup, click Save Session. Basically, you’re done. With this setting, you have to enter the passphrase key every time you connect. If you are too lazy to do it, then start Pageant.exe, in the Utility menu, add the desired key and enter the passphrase once. Utility Pageant keep in memory the passphrase and connect to the server it is not necessary to enter. But it is worth noting that at the close of this utility, all the keys are removed from memory and you need to re-prodelyvat procedure for adding keys in Pageant.
It is also possible reverse operation key generation on the server and use these keys in the putty. But more on that another time.