21 February, 2006

Password less ssh login


  • On the client, generate a new ssh key
    using "ssh-keygen" command . It will ask you for a path to
    save the file, and a passphrase, just press "enter" to
    select alldefault values and to return to console.


    ssh-keygen -t dsa



  • Next copy the file "/home/<user's-home-directory>/.ssh/id_dsa.pub" to the server running "sshd" service using scp or a suitable method. The command mentioned below is for scp.


    scp /home/<user's-home-directory>/.ssh/id_dsa.pub <user>@<server-system>/home/<user's-home-directory>/id_dsa.pub



  • To allow multiple system to connect to the server running sshd, add the content of the "id_dsa.pub" file from another system using the following format


    cat id_dsa.pub >> /home/<user's-home-directory>/.ssh/authorized_keys


  • After setting up the "authorized_keys" file, run the following command to setup the permission correctly


    chmod 0700 /home/<user's-home-directotry>/.ssh -R




And you done :)