Sunday, December 14, 2008

SSH login without password

If you want to make a bakup script like the one I showed you yesterday, you may need to set your machines to login remotely without asking for a password everytime. This is done by sharing between them the public rsa keys generated by the openssh server.

Login as the user you will use for the transfer script and run:

ssh-keygen -t rsa

Answer the questions but do not enter a password because otherwise you will still need to to pass it when the script runs. You should then have two new files in ~/.ssh, id_rsa and id_rsa.pub. Open id_rsa.pub with your favorite editor and copy everything (there is only one line actually) into the ~/.ssh/authorized_keys on the second machine (the one in which you need to copy).

Now try to login and if everything was set properly it won’t ask you for a a password anymore.

No comments:

Your Ad Here