Remotely use root over ssh for unison

5,842

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
Share:
5,842
Elgoog
Author by

Elgoog

I would like to say that I am an entrepreneur, but I'm probably more likely a dreamer. I'm a systems administrator constantly learning new things. Linux and Programming are my passions and I am always looking to learn more.

Updated on September 18, 2022

Comments

  • Elgoog
    Elgoog over 1 year

    I'm a little confused on how to run unison to sync files with group and owner attributes on an ubuntu system, as you need to be root. But I need to do this remotely and automated. I know I can set up ssh keys and the such for my user but that doesn't matter because I still wont be able to ssh as root to do the changes on the remote system.

    I guess my question is; How would I go about using root on the remote system for unison? or is there a way of setting a command for a user to 'auto-run' as root without password?

    Or are there any other ways that I could do this?

    Any guidance with this is appreciated.

  • Sig-IO
    Sig-IO over 12 years
    Yes, you should have an enabled and working root account. The options for 'PermitRootLogin' are 'no', 'yes', and 'without-password'. The last one allowing only logins using ssh-keys.
  • Elgoog
    Elgoog over 12 years
    works like a charm, I never knew about the without-password so thank you!