Strange issue here.
Running a script calling rsync over ssh throws
"Permission denied (publickey). rsync: connection unexpectedly closed (0 bytes received so far) [receiver]"
strangely:
running the script (which simply execs the already tested command) throws the above error
var spawn = require('child_process').spawn;
spawn('rsync', [
'-avc',
'--delete',
'"'+src+'"' ,
'--link-dest="'+path.join(dest, folder_name)+'"',
'"'+path.join(dest, 'latest/')+'"'
],{
cwd: process.cwd(),
env: process.env
});
Try to specify the path to the key
rsync -avz -e "ssh -i /home/thisuser/cron/thishost-rsync-key" remoteuser@remotehost:/remote/dir /this/dir/