SSH - using keys works, but not in a script
- by Garfonzo
I'm kind of confused, I have set up public keys between two servers and it works great, sort of. It only works if I ssh manually from a terminal. When I put the ssh command into a python script, it asks me for a password to login. The script is using rsync to sync up a directory from one server to the other.
manual ssh command that works, no password prompt, automatic login:
ssh -p 1234 [email protected]
In the Python script:
rsync --ignore-existing --delete --stats --progress -rp -e "ssh -p 1234" [email protected]:/directory/ /other/directory/
What gives?
(obviously, ssh details are fake)