Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I always used to use the following command when copying from a server: rsync --progress -avze ssh user@host:/path/to/files ./here. However, a friend of mind showed me that I can simply do rsync --progress -avz user@host:/path/to/files ./here. So the question is, if you do not need -e ssh why is it there anyways?

share|improve this question

4 Answers 4

up vote 5 down vote accepted

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!

share|improve this answer

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.

share|improve this answer
1  
It's required on RHEL 3, for example, as RSYNC_RSH defaults to 'rsh'. –  Kyle Smith Apr 12 '12 at 18:20

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.

share|improve this answer
    
Is -i an option for ssh or rsync in your example? And if it's for ssh, does it work without the single quotes around the command? –  Izkata Apr 12 '12 at 20:44
    
Oh, right, I need the quotes. Editing my Answer now. –  cjc Apr 12 '12 at 21:13

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.