Syncing a write protected folder
TempyOne
tempy_one at web.de
Mon May 30 03:03:40 MDT 2011
Hi,
I've already asked in IRC, but i somehow can't belive this isn't
possible.
I have the folowing testcase (local, on an ext3 fs, no xattr):
.
├── [dr-xr-xr-x] dir1
│ └── [-r--r--r--] text.txt
└── [drwxr-xr-x] target
and what i want after using 'rsync <some options> dir1 target' is:
.
├── [dr-xr-xr-x] dir1
│ └── [-r--r--r--] text.txt
└── [drwxr-xr-x] target
└── [dr-xr-xr-x] dir1
└── [-r--r--r--] text.txt
Now i did some tries:
"rsync -rvt dir1 target" throw an error message:
mkstemp "../target/dir1/.text.txt.AQGaMg" failed: Permission denied
And that's what rsync did so far:
.
├── [dr-xr-xr-x] dir1
│ └── [-r--r--r--] text.txt
└── [drwxr-xr-x] target
└── [dr-xr-xr-x] dir1
What i'm confused about is, after i did the exatcly same command again:
.
├── [dr-xr-xr-x] dir1
│ └── [-r--r--r--] text.txt
└── [drwxr-xr-x] target
└── [dr-xr-xr-x] dir1
└── [-r--r--r--] text.txt
And no error message was thrown.
The only possible way to sync such a folder without any error message
was to change the permissions by hand with '--chmod=u+w' and '--perms'.
The disadvantage: All previous file permissions are 'lost' in the copy.
So i tried after the first sync a second sync where only the file
permissions shall be synced. Thus after the latter command i have:
.
├── [dr-xr-xr-x] dir1
│ └── [-r--r--r--] text.txt
└── [drwxr-xr-x] target
└── [drwxr-xr-x] dir1
└── [-rw-r--r--] text.txt
But after "rsync --perms -r -v dir1 target" i've got an error message
again:
mkstemp "../target/dir1/.text.txt.AP4sMs" failed: Permission denied
And the filetree:
.
├── [dr-xr-xr-x] dir1
│ └── [-r--r--r--] text.txt
└── [drwxr-xr-x] target
└── [dr-xr-xr-x] dir1 <-- correct
└── [-rw-r--r--] text.txt <-- wrong
Ok. So my final question is: Is it even possible what i want to
do with rsync? The real situation is seriously far more complex (dir1
is in fact much bigger) and i realy want somehow to preserve the file
permissions in the copy.
Meanwhile thanks for any advise.
More information about the rsync
mailing list