Thursday, June 30, 2005

Passwordless logins with SSH

Here's how to login without supplying a password for remote machines running ssh.

  • On the local Unix/Linux host or a local Windows host with openssh installed, execute:
    ssh-keygen -t dsa
  • Use scp to copy the $HOME/.ssh/id_dsa.pub from the local machine to the remote ssh host.
  • Login to the remote ssh host.
  • Append the contents of id_dsa.pub to $HOME/.ssh/authorized_keys.
    cat $HOME/id_dsa.pub > $HOME/.ssh/authorized_keys
    rm $HOME/id_dsa.pub
  • Ensure permissions on the $HOME/.ssh directory are strictly for the file owner only.
    chmod 700 $HOME/.ssh
    chmod 600 $HOME/.ssh/*

Alternately, if the local host is Windows and there's no openssh around, then download and install the Putty installer - preferrably the 0.58 version or higher. Then run the puttygen tool, select the dsa option and press Generate. After the key generation is completed, save the public and private keys. Do the same stuff with the public key as mentioned above. [Urk - I'll complete this later - am running late ]

No comments: