Friday, April 18, 2008

Using ssh and scp without a password

ssh and scp are very useful for making sure you work in a pretty secure environment. But sometimes it can be a hassle if you have to keep on keying in your password to login many times to the server or you might need to write a backup script but do not want to write your password in the script then I have found a solution at

Basically what you need to do is copy your public key to the authorized keys file on the server. If you haven't got a public key yet just type in:

ssh-keygen -t dsa

And that will create an file in your ~/.ssh folder (By default, you can set it in other places if you want). Anyway, copy the content of that file (it should be just one line) into the ~/.ssh/authorized_keys file on the server you want to login. Now whenever you ssh username@server you'll access it straight away without any password. And scp also works without password so you can write those scripts.

No comments:

Haiya ala Solah