I found a way out using a script. It first pings server.localdomain
. If there is an answer, we are in the private network, default configuration, so it functions as usual. If the ping fails, the script creates a temporary file /tmp/sshRedirect
containing
Host server.localdomain HostName server.domain.com
and unison
is called with the options -sshargs -FsshRedirect
(it's important that there is no space after F
). This way, unison is transparently redirected.