why does rsync translate user at host into '$RSYNC_RSH -l user host'?

Benjamin R. Haskell rsync at benizi.com
Wed Oct 19 10:02:04 MDT 2011


On Wed, 19 Oct 2011, Kevin Korb wrote:

> Because it is an even bigger joy to be able to type 'ssh newhost' and 
> have it just work even though you can't talk to newhost.  You can do 
> that by properly configuring ssh in ~/.ssh/config with something like 
> this:
>
> Host accessiblehost
>  User cameron
>
> Host newhost
>  ProxyCommand ssh accessiblehost -W %h:%p
>  User root

+1.  Seems easier than a DIY script.


But to answer the original question:

> On 10/19/11 03:40, Cameron Simpson wrote:
>> Why does rsync believe it knows more about the use of the token to 
>> the left of the colon than the program which will be used as the 
>> remote connection?
>>
>> [...]
>>
>> what it invokes is:
>>
>>   sshto -l cameron at accessiblehost!root newhost rsync .....
>>
>> Since sshto is my own tool I can probably have it cope with this 
>> mangling of my target string into "-l foo bah", and undo it.
>>
>> But WHY does rsync believe this is desirable, or even necessary?

rsync has to parse the URL you're passing.  The fact that it then takes 
that and runs something like `$RSYNC_RSH -l user host` is because rsync 
expects it's handing the connection duties off to something that uses 
rsh-like calling conventions.  So, it's "desirable" because rsh-like 
tools traditionally expect it.

If rsync didn't parse the URL and split it out, each tool would have to 
do its own {user}@{host} parsing.  So, it's not fully "necessary". 
(Most of the tools probably do have that kind of parsing.)  It just 
makes things easier for tools that use the '-l' convention.

-- 
Best,
Ben


More information about the rsync mailing list