bsdzone BSDZone - FreeBSD help, how-to guides, and articles.

  [ Home ]   [ Current News ]   [ Howto Archive ]   [ Books ]   [ Search ]   [ Links ]   [ Contact ]  [ About ]  


Putty to OpenSSH
General Admin - 20 Nov 04

Connect to OpenSSH with Putty using RSA Keys.

First get the required software for windows.
You will need Putty.exe and PuttyGen.exe.

Make a folder where you will run Putty from and put both files in it.
Now open Puttygen.exe

puttygen

First you want to change the key bit size to something a bit larger, I use 2048.
Now click Generate….
You must move your mouse over the blank area for puttygen to acquire random data.

puttygen

After if finishes I recommend setting a passphrase for the private key.
If anybody obtains this key file in unencrypted form, they will be able to log into your BSD box without a password.

Now you will want to save your private key to the directory from where you will run Putty.

Now you have to place the Public key on your BSD machine.
First you will create a ~/.ssh (~ = /home/username) directory, then set permissions to something more restrictive. I use 700.
$ cd
$ mkdir .ssh
$ chmod 700 .ssh

Now create a file called authorized_keys in the .ssh directory.
Place the contents of the Public Key genercated by PuttyGen into that file.
Now set permissions to authorized_keys to 600.
$ cd .ssh
$ vi authorized_keys –> enter key data, save, and exit.
$ chmod 600 authorized_keys

You should make sure that your sshd looks for keys is the authorized_keys file.
$ su -
# vi /etc/ssh/sshd_config
I suggest uncommenting the Protocol 2,1 line and removing the 1, (Version 1 is insecure)
Like:
Protocol 2

Now make sure that you set this line. This will tell sshd to look in this file for the public key.
AuthorizedKeysFile .ssh/authorized_keys

Now open a new instance of Putty and set your Private key file location to where you saved it.

putty

Now set the username that you cut the key for. Enter it under Connection –> Auto Login Username.

putty

Now set you hostname, and save the session so you won’t have to enter this every time you start Putty.

putty

All done.


Leave a Reply