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/id_rsa.pub.
    The key fingerprint is:
    79:8a:08:bd:fb:da:71:59:f4:28:e6:c3:01:12:5a:69 user@radon.example.com

    [user@radon ~]$ cd .ssh/
    [user@radon .ssh]$ ls
    id_rsa id_rsa.pub known_hosts
    [user@radon .ssh]$ cat id_rsa.pub > 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 ssh.com’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.
  5.  

  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.
  7.  
     

  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.
  9.  
     

1 thought on “Generating an RSA key pair for use with PuTTY on the N95”

  1. 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 id_rsa2.pub> 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

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