Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'd like to use rsnapshot to backup my local computer as well as two remote machines to a portable storage device. My plan was to use rsnaphot on the local machine, create a backup user on the remote machines, and let my local root access the backup account via ssh public keys. I didn't want to enable root login, I thought this might be a security feature.

So the problem starts: The remote backup user should be able to read as much as possible. How can I accomplish this? I could add this user to every existing group, this way he will be able to read every file which is group-readable. But this way, this user would also be able to write, delete, ... those files. Or I could change the group of every file to backup or some such, but of course this would be too invasive and by the way very insane.

Copy my local root's public key to the remote root account and enabling root login would be the easiest way, heh? Should I do it?

How is this done correctly?

share|improve this question
    
Why not just create any user, and allow them only access to the program rsnapshot via the sudoers file? Append something like backupuser ALL=NOPASSWD:/usr/bin/rsnapshot (or wherever it installs, check with which rsnapshot). Here is an in-depth guide about the sudoers file that applies to more than just Ubuntu. Do not do a root profile :D (even locally, it's just bad practice) –  nerdwaller Jan 10 '13 at 19:54
    
This does not solve the problem I think, sudo rsnapshot will act as root and therefore use roots ssh keys, sudo -u myusername will use my keys, but be useless since I have myusernames access rights. Not easy to solve I think. By the way, on the remote machines I can use root, rsnapshot.org/howto/using-rsnapshot-and-ssh.html shows how to disable root login but allow root to execute commands when authenticated with keys. –  wal-o-mat Jan 13 '13 at 10:53

1 Answer 1

up vote 0 down vote accepted

http://www.rsnapshot.org/howto/using-rsnapshot-and-ssh.html helped me a lot. I ended up with using root on the remote machines, and root as well on my local machine (via sudo of course).

The idea is to have several keys and to restrict the keys to certain commands. For example, I configured my remote host in a way which does not permit root login, but allows to execute a certain command (in my case I think it's rsync, I have to admit I just used the validate-rsync script as suggested in the linked document without thinking too much) if authenticated with public key. So even if someone had access to my local root account, the could not login directly (yes, he maybe could rsync corrupted files and some such, also corrupt the allowed_keys and so on).

At the moment, I think this is the best trade-off between usability and security.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.