Avatar of Mark
 asked on

rsync not deleting, why?

I run the following command:

rsync -rvtO --delete myUser@myHost:/backup/\* /backup/folder/

It copies the files from the source host, but does not delete files in the destination folder that no longer exist on the source. I get no error message. This rsync version is 3.0.4  protocol version 30. The --delete option on other computers just fine. the rsync user does have permission in the /backup/folder directory because I was able to delete a file in that directory by-hand logged in as the rsync user. The /backup directory is a mounted external USB drive.

Any ideas?

Avatar of undefined
Last Comment

8/22/2022 - Mon

more information:

I changed the rsync command to:

rsync -rvtO --delete myUser@myHost:/backup/ /backup/folder

When I ran this rsync command I got:

rsync: delete_file: unlink(2012-02-29-fullbackup.tgz) failed: Permission denied (13)

I checked the permissions on the file:

ls -l /backup/novatec/2012-02-29-fullbackup.tgz
-rw-rw-r-- 1 root backup 13017848257 2012-03-01 03:49 /backup/novatec/2012-02-29-fullbackup.tgz

Then I tried deleting the file manually and got:

rm /backup/novatec/2012-02-29-fullbackup.tgz
rm: remove write-protected regular file `/backup/novatec/2012-02-29-fullbackup.tgz'?

Now, the file is owned by root, and is in group 'backup', and has group rw permission. The user trying to rm the file is a member of group 'backup'. Why is it saying the file is "write-protected"? If I solve this mystery I should be able to get rsync working.

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.

Thanks for the effort.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes