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:
- ssh user@host works, so ssh keys are all set up correctly
- logging and pasting the command being spawned by the script into the terminal works
- running whoami from script shows correct user, and environment is passed to spawn instance via process.env
- running ssh user@host from script does not throw error and returns buffer, so that seems to work
-
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