mattijs / node-rsync

Rsync wrapper for Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rsync specify ssh key

drgroot opened this issue · comments

How would one specify the ssh key using this tool?

You can use the rsync rsh option to specify the remote shell to use:

rsync --rsh="ssh -i ~/.ssh/identity_file" ...

Since node-rsync is just a wrapper that spits out rsync commands this is the equivalent:

var cmd = (new Rsync())
    .set('rsh', 'ssh -i ~/.ssh/identity_file');

or use the shell shortcut:

var cmd = Rsync.build({
  'shell': "ssh -i ~/.ssh/identity_file",
  // ... other options below
});

Alternatively you can also set this up outside of node-resync as an identity in your ssh config file. See this StackOverflow post for more details.