Below are the steps to follow to access your Server using SSH keys with PuTTY and PuTTygen.
-
The first thing you need to do is download the program PuTTygen to generate your public key so you can later add it to
.ssh/authorized_keys -
Once you have downloaded and launched the program, you will see the following image so you can proceed to generate the private key:
-
Now proceed to generate the private key:
The string you need to specify in this example is:
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIBnERhIC5eDep7EYChfc6ENBX++mZzD3hjEeJrIV5sbIr9rpPkU0VETXUyTMB59hAU1+U8tRBbvGQFoSH/5iallYKXAQmqMRyDAQw+BJ8BVGV8Ko2Ng2VZZ6p1I/DBwMfhwMLv/uNfspwlCn2/G0GWy4zvv7VdSRp5jutrBEJMtGw== rsa-key-20130327
In the file where you need to specify the key. It allows more than one key if needed, one per line.
.ssh/authorized_keys file
- You must specify the private key on your SSD VPS Server in the .ssh/authorized_keys file. For security, you need to set secure permissions such as 0400. For example, the .ssh directory should have 0700 permissions.
mkdir -p $HOME/.ssh
chmod 0700 $HOME/.ssh
touch $HOME/.ssh/authorized_keys
chmod 0600 $HOME/.ssh/authorized_keys - Once the directory and file have been created, you must add the string generated in the previous steps.
And that's it! Once you have completed the steps above, you should be able to access the server through PuTTy with your private key using Pageant.
Pageant is a program for Windows that allows temporary access to your private key. Programs such as PuTTy or WinSCP, use Pageant to securely use the generated private key.
WinSCP is a Free Software application. It is a graphical SFTP client for Windows that uses SSH. Its main purpose is to facilitate secure file transfers between two computer systems, the local system and a remote system that provides SSH services.
Pageant allows you to load a private key by asking for your password, thereby giving other programs indirect access through PuTTy to establish connections using SSH with your private key to servers that accept our public key, generally through the file ".ssh/authorized_keys".