SSH Passwordless Authentication

| Posted by watashii | Filed under Software, Unix

This post shows how to use PuTTY (Windows) to login to a remote server (UNIX) over SSH without password.

Step 1 – Setting up the remote server (UNIX)

Login to the remote server using the normal username and password.

Ensure that no-one but the user can access the .ssh path and authorized_keys file within the user directory

$ cd ~
$ chmod 700 .ssh
$ chmod 600 .ssh/authorized_keys

In the .ssh directory, we will create a public/private key-pair which will form the basis for authetication between the client and server.  Unix utility ssh-keygen will accept DSA or RSA (two commonly used key types) with a default 1024 bits key size.  Follow the prompts and accept the default filename, and leave an empty passphase to create your passwordless login.

$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (~/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Your identification has been saved in ~/.ssh/id_dsa.
Your public key has been saved in ~/.ssh/id_dsa.pub.
The key fingerprint is:
21:15:5d:13:68:42:10:46:bd:fa:bd:b6:7c:5d:64:f1

You should now have the key-pair files named id_dsa.pub and id_dsa.  Append the public key in authorized_keys as per below.

$ cat id_dsa.pub >> .ssh/authorized_keys

Step 2 – Generating the PuTTY private key (Windows)

You will need to transfer the id_dsa private key file on to the Windows client PC via SFTP (or various means).  Launch the puttygen Windows utility, go to [File > Load private key], and open your private key.

Save private key without a passphrase, as shown below, and name the file with a .ppk extension.

Step 3 – Setting up the PuTTY client (Windows)

So now you have a PuTTy-generated private key .ppk file, we can now use this to PuTTy-login to the UNIX server without needing a password.

Open your PuTTy Windows client, and before you connect your session, select the .ppk private key you generated under [SSH > Auth].

Share:

  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Print
  • email

Related Posts:

  1. BusinessObjects InfoView LDAP Authentication Error
  2. Oracle SQLPlus Query Output to a File
  3. Starting / Shutdown Oracle Database in Unix

Tags: , , , ,

Leave a Reply