2

I'm trying to set up remote backups with rsnapshot from my home server. I want my server to connect into my laptop and take backups over SSH.Everything is set up correctly and I can connect from my server to the laptop perfectly.

The problem is I'm getting a permission error when I run sudo rsnapshot -v hourly (from the server):

...
rsync: opendir "/foo/bar" failed: Permission denied (13)
...

I've created a separate backup user on my laptop and I'm connecting over ssh with this user. This is my ~/.ssh/config that rsnapshot is making use of:

Host macbookpro
    HostName macbookpro
    PreferredAuthentications publickey
    User backup
    Identity File ~/.ssh/keys/macbookpro.id_rsa

I've also added the following to my sudoers file on my laptop which should allow rsync to run as root when called remotely by rsnapshot:

backup  ALL=(root)      NOPASSWD:       /usr/bin/rsync

yet whenever I run rsnapshot I continue to get permission errors. Does anyone see what's wrong?

1 Answer 1

0

Ok, looks like I figured it out. Poking around on my laptop, I tried to run the rsync command (that rsnapshot would normally invoke over ssh) manually as the backup user and noticed I was getting permission errors locally as well.

It seems that even if you have the entry in your sudoers file to explicitly allow a user run a certain binary without a password, you still need to actually preface your command with sudo. (I'm on a macbook so I'm not sure if this is particular to OSX)

There didn't seem to be a good way to do this in rsnapshot.conf so I followed the instructions in this tutorial

I made a file on my laptop called rsync_sudo.sh and added the following:

/usr/bin/sudo /usr/bin/rsync "$@";

then symlinked it to /usr/bin/ and back on my server I added the following to /etc/rsnapshot.conf:

rsync_long_args         --rsync-path=rsync_sudo.sh --delete --numeric-ids --relative --delete-excluded

and now everything seems to be working

1
  • Didn't really resolve it for me. Same rights issues are coming up all over the place.
    – Ain Tohvri
    Dec 13, 2015 at 17:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .