Remotely use root over ssh for unison

Solution 1:

You should be able to setup ssh login with keys as you have stated.

Make sure your sshd_config allows root logins

PermitRootLogin without-password

Then copy the generated public-key to /root/.ssh/authorized_keys.

You should be able to login now, just tell unison to use the ssh key you generated.

Solution 2:

Sudo can be configured to avoid asking for a password on some or all commands with the NOPASSWD parameter; but in any case I think it would be simpler to use ssh keys to access the remote system directly as root; after setting up passwordless authentication, unison should be called as follows:

unison a.tmp ssh://username@remotehostname/a.tmp