Discussion:
[unison-users] Unison and rsync with non standard ssh port
bk@e8s.de [unison-users]
2015-12-13 19:12:08 UTC
Permalink
Hi,

I needed to change my unison configuration to use a non standard port for ssh and realized, that it doesn’t work with rsync. My config looked liked this and worked fine:

root = /local/path
root = ssh://***@host//path
auto = true
batch = true
sortbysize = true
copythreshold = 1000
perms = 0
maxthreads = 4
[
 skipped all the ignores]

To change the default port I altered the URL in the second line to root = ssh://***@host:PORT//path. This worked fine until unison invoked rsync. Rsync still tried to connect to port 22. To work around this I added the following lines to the config and it worked again:

copyprog = rsync -e "ssh -p 2201" --inplace --compress
copyprogrest = rsync -e "ssh -p 2201" --partial --inplace --compress

However, having to specify the port at three different locations seems a bit awkward to me. Am I missing a unison option here or is this buggy behavior?

Thanks for any replies
Ben
Adrian Klaver adrian.klaver@aklaver.com [unison-users]
2015-12-13 20:20:34 UTC
Permalink
Post by ***@e8s.de [unison-users]
Hi,
I needed to change my unison configuration to use a non standard port
for ssh and realized, that it doesn’t work with rsync. My config looked
root = /local/path
auto = true
batch = true
sortbysize = true
copythreshold = 1000
perms = 0
maxthreads = 4
[
 skipped all the ignores]
To change the default port I altered the URL in the second line to root
Why not use an ssh config file under ~/.ssh:

http://nerderati.com/2011/03/17/simplify-your-life-with-an-ssh-config-file/
Post by ***@e8s.de [unison-users]
rsync. Rsync still tried to connect to port 22. To work around this I
copyprog = rsync -e "ssh -p 2201" --inplace --compress
copyprogrest = rsync -e "ssh -p 2201" --partial --inplace --compress
Why do the above? The default without explicitly specifying rsync in a
profile is:

copyprogrest = rsync --partial --append-verify --compress
copyprog = rsync --partial --inplace --compress

If you do not want to use the implicit defaults, then just do something
similar to the above without the call to ssh, which is redundant.
Post by ***@e8s.de [unison-users]
However, having to specify the port at three different locations seems a
bit awkward to me. Am I missing a unison option here or is this buggy
behavior?
Thanks for any replies
Ben
--
Adrian Klaver
***@aklaver.com
Adrian Klaver adrian.klaver@aklaver.com [unison-users]
2015-12-14 21:51:52 UTC
Permalink
Post by Adrian Klaver ***@aklaver.com [unison-users]
Post by ***@e8s.de [unison-users]
Hi,
I needed to change my unison configuration to use a non standard port
for ssh and realized, that it doesn’t work with rsync. My config looked
root = /local/path
auto = true
batch = true
sortbysize = true
copythreshold = 1000
perms = 0
maxthreads = 4
[
 skipped all the ignores]
To change the default port I altered the URL in the second line to root
http://nerderati.com/2011/03/17/simplify-your-life-with-an-ssh-config-file/
Thanks for the hint, but in my case the destination is actually behind a
NAT, so I need to be able to configure more than one SSH port for one
IP. I could hard code some host names in /etc/hosts of course, but that
would make it three config files to keep track of. In that case I rather
stay with the three lines in one config file :-).
You can configure host names in config:

Host host1_port22
User aklaver
Port 22
Hostname 123.345.67.890

Host host1_port45000
User aklaver
Port 45000
Hostname 123.345.67.890


etc

Then this works for works for whatever program you use with SSH. I found
it a lifesaver, change one file and my SSH connections keep on rolling.
Post by Adrian Klaver ***@aklaver.com [unison-users]
Post by ***@e8s.de [unison-users]
rsync. Rsync still tried to connect to port 22. To work around this I
copyprog = rsync -e "ssh -p 2201" --inplace --compress
copyprogrest = rsync -e "ssh -p 2201" --partial --inplace --compress
Why do the above? The default without explicitly specifying rsync in a
copyprogrest = rsync --partial --append-verify --compress
copyprog = rsync --partial --inplace —compress
Then I got this wrong. I was looking for the default and found somewhere
the —inplace —compress parameters. I guess it is outdated or even was
wrong from the start.
Post by Adrian Klaver ***@aklaver.com [unison-users]
If you do not want to use the implicit defaults, then just do something
similar to the above without the call to ssh, which is redundant.
It does work without the ssh call, now, although I was pretty sure it
didn’t yesterday. Anyway, thanks for the answer!
Ben
Post by Adrian Klaver ***@aklaver.com [unison-users]
Post by ***@e8s.de [unison-users]
However, having to specify the port at three different locations seems a
bit awkward to me. Am I missing a unison option here or is this buggy
behavior?
Thanks for any replies
Ben
--
Adrian Klaver
--
Adrian Klaver
***@aklaver.com
Loading...