D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

[LUG] ssh keys



Hi,
   Getting SSH to use keys is quite straigh forward but it can be quite
confusing. On the client machine you need to create a set of keys. This
is done with this command :


ssh-keygen -t dsa  


    It will then say "Generating public/private dsa key pair". Next it
will ask you where to save the private key. We want the default so just
press <enter>. It will now ask for a password. Don't set one. Aparently
if you do it can't be used for our purpose. Perhaps someone knows for sure?

    After you've pressed <enter> twice it will give you some information
about the keys it has generated. We now have to get the public key onto
the server and put it in the right place. The easiest way is with scp :


scp <home area>/.ssh/id_dsa.pub   <server name>:<home area>/


    Example :

scp /root/.ssh/id_dsa.pub hammond:/root

    or :

scp /home/jbloggs/id_dsa.pub stargate:/home/jbloggs




    It will ask for a password to do this. After it has copied SSH into
the server. We need to add the public key to the list of authorised
keys. The easiest way is to use cat to add the keys to the list :



cat id_dsa.pub >>  .ssh/authorized_keys2

  
    This should be all you need to do to get password-less SSH logins.
Hope this is of some use!


Kind Regards,


Peter Palmer

*************************************************

Lynx friendly