If I run the command via php exec(): It does not work. But if I use bash, it runs perfect. Any idea what the problem might be.? I was thinking maybe it is executing rsync as
Here's how you specify where should SSH pick up your keys:
exec('rsync -e "ssh -i /home/you/.ssh/id_dsa" ...')
I assume that Apache runs under user that can read your id_dsa or id_rsa.
id_dsa
id_rsa