FreeBSD: SSH public/private key (puTTY)

Install puTTY and run puttygen.exe (preferably run as Administrator)

Generate a key pair. Save private key. You do NOT need to save the public key.
Login into the server and go to the home folder of the user.
(either /root or /home/USERNAME)
Here is a download/fetch SH script to do tasks: sshkey.sh

Assuming, we want to add the key pair to user ‘admin‘:
mkdir /home/admin/.ssh # create .ssh folder
chown admin:admin /home/admin/.ssh # set group policy
chmod 700 /home/admin/.ssh # set permissions drwx——
copy the public key from puttygen (the blue highlighted incl. the ssh-rca at the beginning !) and save it in the file /home/admin/.ssh/authorized_keys
chown admin:admin /home/admin/.ssh/authorized_keys # set group policy
chmod 600 /home/$user/.ssh/authorized_keys # set permissions -rw——-
ls -la /home/admin/.ssh/ # verify
EDIT file /etc/ssh/sshd_config and uncomment line PubkeyAuthentication yes
service sshd restart # restart SSH:

Now in puTTY, you can add the private key under connection-SSH-Auth-Credentials.
And that’s it.

Leave a Reply

Your email address will not be published. Required fields are marked *