0

I've used rsync for years to keep a backup copy of my /home/User1 (Client1) on my Server1 (in a folder /mnt/Server1/Backup). These are not production machines. This folder is mounted on Client1 with NFS at boot in the /mnt/Server1/Backup folder (so /mnt/Server1/Backup on Server1 is mounted with NFS on Client1 in /mnt/Server1/Backup).

On both machines, /mnt/Server1/Backup belongs to User1/Group1 with permissions 770.

I installed rsnapshot on Client1 with the intention of getting it to backup on a daily basis in the folder (/mnt/Server1/Backup). User1 already exists on Client1 and Server1 and can SSH with keys and no password.

I've added the following to /etc/rsnapshot.conf:

##############################
### SNAPSHOT ROOT DIRECTORY ##
##############################


snapshot_root   /mnt/Server1/Backup/

##############################
### BACKUP POINTS/ SCRIPTS ###
##############################

# LOCALHOST
backup /home/User1  Client/

When I launch "rsnapshot configtest" I get "Syntax OK".

When I run "rsnapshot -t alpha" I get the following:

[dom ott 14, 01:12 ][user1@client1:~]rsnapshot -t alpha
echo 23033 > /var/run/rsnapshot.pid 
mkdir -m 0755 -p /mnt/Server1/Backup/rsnapshot/alpha.0/ 
/usr/bin/rsync -a --delete --numeric-ids --relative --delete-excluded \
    /home/Client1/ /mnt/Server1/Backup/rsnapshot/alpha.0/Client1/ 
touch /mnt/Server1/Backup/rsnapshot/alpha.0/ 
[dom ott 14, 01:12 ][user1@client1:~]

It seems like all is fine. However, when I launch without option t I get the following:

[dom ott 14, 01:12 ][user1@client1:~]rsnapshot alpha
----------------------------------------------------------------------------
rsnapshot encountered an error! The program was invoked with these options:
/usr/bin/rsnapshot alpha 
----------------------------------------------------------------------------
ERROR: Could not write lockfile /var/run/rsnapshot.pid: Permission denied

rsnapshot is complaining because there are no sufficient permissions for it to write the PID on main filesystem of Client1.

I don't think I should be using sudo otherwise how do I create a cronjob without asking of password?

I could use an ad hoc debian user "backup" ... but how do I resolve the PID problem?

  • I'm not familiar with rsnapshot, but I'll add a comment about the sudo part: there is a NOPASSWD option that can be used with sudo to avoid password prompts. – Haxiel Oct 14 '18 at 13:30
2

In actual fact the sudo option is not working itself because it says that it can't write on the /mnt/Server1/Backup folder

     [dom ott 14, 01:15 ][antonio@gaia:~]sudo rsnapshot alpha
     [sudo] password di User1: 
     ----------------------------------------------------------------------------
     rsnapshot encountered an error! The program was invoked with these options:
     /usr/bin/rsnapshot alpha 
     ----------------------------------------------------------------------------
     ERROR: Could not mkpath("/mnt/Server1/Backup/rsnapshot/alpha.0/", 0, 0755);

I have found a workaround. rsnapshot had an option to set where the PID file is written. I set it as such:

     lockfile   /mnt/Server1/Backup/rsnapshot

I've also assigned the backup group to the above folder. Finally, what I've also realised is that rsnapshot is not even using SSH because I have the remote folder mounted on Client1 via NFS.

  • Sorry, guys, maybe this should have been a comment rather than an answer? Still getting my head around StackExchange ... – MiniTux Oct 14 '18 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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