So I have set up a password-less ssh login for a server. I can run rsync from the command line, and it works beautifully, and doesn't ask me for a password:
rsync -avz -e ssh myDir [email protected]:/place/myDir
However, when I put this in a bash script and execute the script, it stops to ask me for a password.
#!/bin/bash
rsync -avz -e ssh myDir [email protected]:/place/myDir
Why is this happening? What should I look for to stop this?
You may need to add the path to your identity file like this:
You need to source your ssh agent. I use keychain for this.
http://www.ibm.com/developerworks/library/l-keyc2/
I like to set up ssh configurations in a configuration file - ~/.ssh/config
It looks like this
Then I
ssh xxx-master
and it asks me for the passphrase. While I continue to be logged into xxx-master, I canssh xxx
without a passphrase.Is this better than ssh agent? I don't know. I use this method because I have not figured out ssh-agent.