Repeated Backup

The place to post if you need help or advice

Moderators: ChrisThornett, LXF moderators

Repeated Backup

Postby steve-r » Thu Mar 27, 2014 2:00 pm

In issue 182, Answers section, it was suggested to use the rsync daemon on a server to send backups to.

I currently use "normal" rsync for this. If I try using rsync as a daemon I can't find the options to keep the ownership of the original files - surely a MUST for any form of backup.
Any files I transfer this way end up owned by nobody:nogroup.

Are there options to rsync daemon that WILL retain ownership?

Steve
steve-r
 
Posts: 12
Joined: Wed Jul 27, 2005 9:31 am
Location: Edinburgh, Scotland

Postby nelz » Thu Mar 27, 2014 2:23 pm

When you define the tartet in /etc/rsyncd.conf, use the uid parameter to specify the user to create the file as. You can either use a specific user name or

Code: Select all
uid = %RSYNC_USER_NAME%
gid = *


This uses the same user ID that was used to authenticate the connection.
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
User avatar
nelz
Site admin
 
Posts: 8579
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK

Postby steve-r » Thu Mar 27, 2014 3:16 pm

Hi nelz,
Thanks for the reply.

My rsyncd.conf has (with your suggestion);

Code: Select all
max connections = 4
log file = /var/log/rsync.log
timeout = 300
dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz *.Z

[test]
   path = /data/test
   comment = test
   read only = no
   list = yes
   uid = %RSYNC_USER_NAME%
   gid = *


The command on the remote host is

Code: Select all
rsync -avP --numeric-ids --delete --stats --inplace /home/steve/ rsync://test@IPADDRESS/test/home/steve/


Without the uid and gid lines this works but everything ends up owned by nobody:nogroup.
If I add the uid and gid lines I get;

@ERROR: invalid uid %RSYNC_USER_NAME%

Steve
steve-r
 
Posts: 12
Joined: Wed Jul 27, 2005 9:31 am
Location: Edinburgh, Scotland

Postby nelz » Thu Mar 27, 2014 7:08 pm

Does it work with

Code: Select all
uid = steve
gid = *


Assuming your username is steve.
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
User avatar
nelz
Site admin
 
Posts: 8579
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK

Postby steve-r » Fri Mar 28, 2014 9:33 am

If I set;

uid = steve
gid = steve

it does "work" but the received files are then owned by steve:steve rather than the original owner.

gid = * was not liked. I get an Invalid gid message
steve-r
 
Posts: 12
Joined: Wed Jul 27, 2005 9:31 am
Location: Edinburgh, Scotland

Postby nelz » Fri Mar 28, 2014 9:55 am

Which version of rsync are you using. gid = * works with 3.1.0 here. It seems you need to set u user authentication, with auth users, for the username to be passed through. The man pages explain how to do this, start with man rsyncd.conf.
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
User avatar
nelz
Site admin
 
Posts: 8579
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK

Postby steve-r » Fri Mar 28, 2014 10:36 am

The server (Debian Stable) is 3.0.9, the client (Ubuntu 10.04 LTS) is 3.0.7
steve-r
 
Posts: 12
Joined: Wed Jul 27, 2005 9:31 am
Location: Edinburgh, Scotland

Postby steve-r » Fri Mar 28, 2014 11:25 am

What I have found to work is if I;

Code: Select all
uid = root
gid = root


and if I change the remote host command to read;

Code: Select all
rsync -avP --numeric-ids --delete --stats --inplace /home/steve/ rsync://IPADDRESS/test/home/steve/


Thanks for your help!
steve-r
 
Posts: 12
Joined: Wed Jul 27, 2005 9:31 am
Location: Edinburgh, Scotland

Postby nelz » Fri Mar 28, 2014 1:22 pm

This entails running the server as root, which is a security risk. It's not too bad if it is only on your local network, but do not expose this to the Wild West Web.
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
User avatar
nelz
Site admin
 
Posts: 8579
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK


Return to Help!

Who is online

Users browsing this forum: No registered users and 1 guest