Do you need -e ssh for rsync?

Solution 1:

Any time you need additional options to the ssh command outside of the user and host, then you need the -e flag. Perhaps the server you're connecting to has ssh listening on port 2222.

rsync -e 'ssh -p 2222' /source usr@host:/dest

An alternative to getting around this, there are 2 files you can use. /etc/ssh/ssh_config or ~/.ssh/config

The config file uses the same format as ssh_config. It's just able to be configured on a per user basis!

Solution 2:

You would also need -e if you use a non-default private key location, i.e., specify the private key via -e 'ssh -i /path/to/private/key/file.pem'. For that matter, non-default listen ports for sshd, also. Basically, use -e if just using ssh user@host doesn't work.


Solution 3:

You don't need -e ssh to use ssh. In fact, if you specify the target as user@host:/path/to/files, you're using ssh by default. It's left in a) for compatibility reasons and b) fringe cases where you might have a combination of rsyncd and ssh hosts.


Solution 4:

It depends on what was specified for the --with-rsh configure option at compile time. The default is now ssh if this option wasn't specified. It had been rsh at some time in the past, however even if it is rsh, It might not be necessary as ssh might be the default rsh implementation on many boxes. On all my machines, for example readlink -f $(which rsh) shows that rsh is really just a symlink pointing to /usr/sbin/ssh

Tags:

Backup

Rsync