please ensure you are using sudo while using rsync .
On Fri, Nov 23, 2012 at 8:04 PM, Balasubramaniam Natarajan < [email protected]> wrote: > Hi > > I have two boxes Bodhidarmar -> server and backup (as backup_server) , I am > trying to backup the /var/log/ folder from the server on to the backup > machine. What I found is while trying to restore the files from the backup > machine to the server rsync is changing the owner. I am not sure why this > happens even when I use the -a switch while using rsync. > > *man pages of rsync* > rsync -*a*vz foo:src/bar /data/tmp > > This would recursively transfer all files from the directory > src/bar on the machine foo into the /data/tmp/bar > directory on the local machine. The files are transferred in > "archive" mode, which ensures that symbolic links, > devices, attributes, permissions, *ownerships*, etc. are preserved > in the transfer. Additionally, compression will > be used to reduce the size of data portions of the transfer. > > For example let us consider just auth.log > > *Step1:* Here I show that auth.log has syslog and adm as owner and group. > root@Bodhidarmar:~/.ssh# ls -ltrh /var/log/auth.log > -rw-r----- 1 syslog adm 147K 2012-11-17 06:25 /var/log/auth.log > > *Step2:* I am trying to backup just auth.log > backup@bala-desktop:/backup$ ls > backup@bala-desktop:/backup$ rsync -avz -e 'ssh -i > /home/backup/.ssh/backup' root@bodhidarmar:/var/log/auth.log /backup/ > receiving incremental file list > auth.log > > sent 30 bytes received 9501 bytes 6354.00 bytes/sec > total size is 150330 speedup is 15.77 > backup@backup:/backup$ ls -ltrh > total 148K > -rw-r----- 1 sebackup adm 147K 2012-11-16 19:55 auth.log > sebackup@backup:/backup$ > > *Step3:* I am deleting the auth.log on my server, so that I can restore it > from the backup which I just created. > root@Bodhidarmar:~/.ssh# rm /var/log/auth.log > > *Step4: *I am restoring the auth.log > backup@backup:/backup$ rsync -avz -e 'ssh -i /home/backup/.ssh/backup' > /backup/auth.log root@bodhidarmar:/var/log/ > sending incremental file list > auth.log > > sent 9499 bytes received 31 bytes 6353.33 bytes/sec > total size is 150330 speedup is 15.77 > backup@backup:/backup$ > > *Step5: *Here you can see that it is assigned to aravind instead of syslog > root@Bodhidarmar:~/.ssh# ls -ltrh /var/log/auth.log > -rw-r----- 1 *aravind* adm 147K 2012-11-17 06:25 /var/log/auth.log > > -- > Regards, > Balasubramaniam Natarajan > www.blog.etutorshop.com > _______________________________________________ > ILUGC Mailing List: > http://www.ae.iitm.ac.in/mailman/listinfo/ilugc > -- Vijai Ganapathy Mailto: [email protected] _______________________________________________ ILUGC Mailing List: http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
