Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Repeated Backup

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Help!
View previous topic :: View next topic  
Author Message
steve-r



Joined: Wed Jul 27, 2005 10:31 am
Posts: 12
Location: Edinburgh, Scotland

PostPosted: Thu Mar 27, 2014 2:00 pm    Post subject: Repeated Backup Reply with quote

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
Back to top
View user's profile Send private message
nelz
Site admin


Joined: Mon Apr 04, 2005 12:52 pm
Posts: 8450
Location: Warrington, UK

PostPosted: Thu Mar 27, 2014 2:23 pm    Post subject: Reply with quote

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:
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)
Back to top
View user's profile Send private message
steve-r



Joined: Wed Jul 27, 2005 10:31 am
Posts: 12
Location: Edinburgh, Scotland

PostPosted: Thu Mar 27, 2014 3:16 pm    Post subject: Reply with quote

Hi nelz,
Thanks for the reply.

My rsyncd.conf has (with your suggestion);

Code:

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:

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
Back to top
View user's profile Send private message
nelz
Site admin


Joined: Mon Apr 04, 2005 12:52 pm
Posts: 8450
Location: Warrington, UK

PostPosted: Thu Mar 27, 2014 7:08 pm    Post subject: Reply with quote

Does it work with

Code:
uid = steve
gid = *


Assuming your username is steve.
_________________
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
Back to top
View user's profile Send private message
steve-r



Joined: Wed Jul 27, 2005 10:31 am
Posts: 12
Location: Edinburgh, Scotland

PostPosted: Fri Mar 28, 2014 9:33 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
nelz
Site admin


Joined: Mon Apr 04, 2005 12:52 pm
Posts: 8450
Location: Warrington, UK

PostPosted: Fri Mar 28, 2014 9:55 am    Post subject: Reply with quote

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)
Back to top
View user's profile Send private message
steve-r



Joined: Wed Jul 27, 2005 10:31 am
Posts: 12
Location: Edinburgh, Scotland

PostPosted: Fri Mar 28, 2014 10:36 am    Post subject: Reply with quote

The server (Debian Stable) is 3.0.9, the client (Ubuntu 10.04 LTS) is 3.0.7
Back to top
View user's profile Send private message
steve-r



Joined: Wed Jul 27, 2005 10:31 am
Posts: 12
Location: Edinburgh, Scotland

PostPosted: Fri Mar 28, 2014 11:25 am    Post subject: Reply with quote

What I have found to work is if I;

Code:
uid = root
gid = root


and if I change the remote host command to read;

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


Thanks for your help!
Back to top
View user's profile Send private message
nelz
Site admin


Joined: Mon Apr 04, 2005 12:52 pm
Posts: 8450
Location: Warrington, UK

PostPosted: Fri Mar 28, 2014 1:22 pm    Post subject: Reply with quote

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)
Back to top
View user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Help! All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast