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.
- 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:
[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.
- 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
- 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.
- 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.
- 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.
- Press Back twice to go back to the main PuTTY screen, then press Options -> Connect and you are now connected without needing a password.