You are here

Linux/PuTTY Auto Login

More how-tos to help me remember:

The keygen only needs to be generated once on one machine:

[shanon@myserver shanon]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/shanon/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/shanon/.ssh/id_dsa.
Your public key has been saved in /home/shanon/.ssh/id_dsa.pub.
The key fingerprint is:
7b:ab:75:32:9e:b6:6c:4b:29:dc:2a:2b:8c:2f:4e:37 shanon@myserver

What you just did was generate 2 keys:

  1. A public key that you put on the server/s(id_dsa.pub)
  2. A private key that you keep on your PC (id_dsa)

Next, copy your public key (id_dsa.pub) into authorized_keys and make authorized_keys readable only by you:

[shanon@myserver shanon]$ cp /home/shanon/.ssh/id_dsa.pub /home/shanon/.ssh/authorized_keys
[shanon@myserver shanon]$ chmod og-rwx /home/shanon/.ssh/authorized_keys

Now, you can copy authorized_keys to other machines if you need.

PuTTY uses a proprietary key format so you'll need to convert the id_dsa to its format using the following procedure:

To use the key with putty, you'll need to copy the id_dsa file to your PC then import it to a file that Putty can use:


1) Download PuTTYgen from
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
2) Run it, and go to Conversions | Import Key
3) Click on the key you want to import, and enter your passphrase
4) Update the key fingerprint, comment and passphrase as desired
5) Save the keys using the 'Save public key' and 'Save private key' options

Make sure you change the ``Preferred SSH protocol version'' to 2 if
you're using SSHv2 keys.

Last, in Putty itself, go to Connection -> SSH -> Auth and pick the .ppk file you generated above to use when logging into that machine.

Don't forget to "Save" the new session in PuTTY so it uses it again.
Shanon

From: http://sshkeychain.sourceforge.net/mirrors/SSH-with-Keys-HOWTO/SSH-with-Keys-HOWTO-4.html

User login