Generating an RSA key pair for use with PuTTY on the N95

As I started my tutorial on adding fonts to PuTTY on the N95, I very quickly decided that having to enter a user name and password every time I logged in was taking too long. So I generated an RSA key pair with a blank pass phrase just to save time. Don’t worry, of course I deleted the key pair as soon as I was finished. The last thing I need is to lose my phone and have some stranger logging into my server!

Note: this procedure is not specific to just the N95, nor is it only specific to Linux. I use Linux in my examples because I’m not a Windows user. The procedure described below on how to generate RSA keys can be adapted to puttygen.exe on Windows.

  1. Here is what I did on the Linux box first:

    [user@radon ~]$ ssh-keygen
    Generating public/private rsa key pair.
    Enter file in which to save the key (/home/user/.ssh/id_rsa):
    Created directory ‘/home/user/.ssh’.
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /home/user/.ssh/id_rsa.
    Your public key has been saved in /home/user/.ssh/
    The key fingerprint is:

    [user@radon ~]$ cd .ssh/
    [user@radon .ssh]$ ls
    id_rsa known_hosts
    [user@radon .ssh]$ cat > authorized_keys
    [user@radon .ssh]$ chmod 644 authorized_keys

    The chmod command above is very important. Your authorized_keys file must only be writable by you. If is is group writable sshd will refuse to use it.

  2. This step is also very important! Next you must convert your OpenSSH private key into PuTTY’s SSH-2 key format. I initially tried using the OpenSSH private key itself, not realizing that PuTTY couldn’t read it properly. It took a bit of digging to figure out why it wasn’t working. Who knew that PuTTY, OpenSSH, and’s implementations of SSH-2 keys were so different?

    [user@radon .ssh]$ puttygen id_rsa -o id_rsa.ppk

  3. Next, I plugged my N95 into my laptop with a USB cable and copied id_rsa.ppk to a temp folder on the phone’s mass memory.
  4. Now, fire up PuTTY on your N95 and choose Options -> Edit -> General, then add the remote host name or address, as well as your user name.

  6. Next, press the Right toggle once to move to the next screen. This is where you select your Private Key. Follow the sequence outlined in the screenshots below to see how I chose E:\temp\id_rsa.ppk.

  8. Press Back twice to go back to the main PuTTY screen, then press Options -> Connect and you are now connected without needing a password.

{ 1 comment… add one }
  • Arturo December 6, 2008, 8:04 pm

    Hola… como estan… me gusto mucho este articulo…
    pero tengo una pregunta… puedo tener varias claves publicas y privadas en el mismo servidor… osea supongamos que tenemos un servidor y dos equipos… los llamare lx1 y lx2… puedo crear una clave para lx1 y otra diferente para lx2 ……. debo aclarar que la clave para lx2 se creo desde lx1 y al hacer cat> authorized_keys…temo que se sobreescriba y quede inabilitado la clave para lx1… lo que me dejaria fuera del servidor… puedes ayudarme .. te lo agradecere siempre.

Leave a Comment