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:
[[email protected] ~]$ 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 [email protected]
[[email protected] ~]$ cd .ssh/
[[email protected] .ssh]$ ls
id_rsa id_rsa.pub known_hosts
[[email protected] .ssh]$ cat id_rsa.pub > authorized_keys
[[email protected] .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?
[[email protected] .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.