Results 1 to 6 of 6
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Mar 2010
same files get duplicated after rsync
I was trying to write a script that allows an incremental back up on Ubuntu Server 10.04. It's a very simple script that uses rsync.
I am doing an experiment to see how rsync works. it really impressed me. It works for me. However, I found something strange but I think this has to do with the permission and file owner.
I have a folder called "important notes" that I have a copy on my external hard drive and another copy on the server. In my experiment, when I run the script. The rsync did copy everything from the external HD to my server. But instead of overwritting the old one with the new one, I saw duplications everywhere.
rwxrwxrwx 1 user1 user1 ... file1.bak
rwxr-xr-x 1 root root ... file1.bak~
Does this mean that I have to manually set the permission from 755 to 777 (for root) before the script is run. What's the best practice here?
Any help would be greatly appreciated.
Not sure what permissions you are passing to your client or server. I know there a way to make rsync make copies, but to create backups on the other end, which sounds like that's what is happening. So I'd check your client side settings first off.
Secondly, if you are running rsync as root, then you should be ashamed of yourself as its a major no-no. Check your server configs (I use /etc/rsyncd.conf):
uid = nobody gid = users ...(some other configs) incoming chmod = Du=rwx,Dgo=rx,Fu=rw,Fg=rw,Fo=r
For each rsync module, you can set different uids,gids, and masks.linux user # 503963
file1.bak~ is not the same as file1.bak, right?
That just means you have edited file1.bak owned by root as user1, with an editor that created a file1.bak~ file as a backup, and rsync is backing it up also, as it should. No?
backup the backup file file1.bak~, the backup file of file1.bak... lovely.
Are you maybe using a -b in your rsync command?
rsync - Linux Command - Unix Commandlinux user # 503963
- Join Date
- Mar 2010
Oh, so it was the -b option that was creating the ~ files on the destination, right? Well done, scathefire.