1

Possible Duplicate:
How to automate SSH login with password?

Is there a way to call ssh in a bash script and automatically feed it the password for the account?

e.g if i type

ssh owen@myserver.com /settings

it prompts me for a password. I want to avoid that!

Owen
  • 13
  • 3

1 Answers1

3

You can use passwordless authentication with SSH using SSH Keys.

On your client machine, run

ssh-keygen -t rsa

This will generate 2 files ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub, these are your public and private authentication keys.

Copy ~/.ssh/id_rsa.pub from your client machine on to your target as ~/.ssh/authorized_keys2.

You should now be able to access your server without needing a password.

Jamescun
  • 422
  • 4
  • 7