# rsync permission issue [SOLVED sort of]

## SweepingOar

I'm trying to backup my server onto my mythtv box, but I keep getting permission errors. I'm using rsync over ssh with the following flags:

```
rsync -vrlHpogt --rsh='/usr/bin/ssh -p509' myUser@server:/www .
```

The www directory is owned by the user that I'm logging in as. There are a bunch of images that are owned by apache because they're uploaded by a cms and it seems like the more recent uploaded images are the ones that are failing to get copied. The weird thing is that when it lists the error files, it does it with some random characters at the start and end of the file names like so:

www/someSite/public/images/small/.lxkdjf9.image5065.gif.fjsldwl

but the actual file on the server is just called "image5065.gif" so I don't know what the deal is with the extra characters. I'm not exactly sure if the period characters are placed correctly (I don't have access to that machine at the moment), but that's the look of it and it happens with a few hundred images. When I log onto the server directly and search for files starting with a period character (aka hidden files), there aren't any in that directory so that makes me thing this is some issue with rsync.

Anyone know what the story is?

Also the user that I'm connecting as is in the apache group so I don't see why it would complain about copying the files.

```
$ more /etc/group

apache:x:81:apache,myUser
```

Some typical ls entries for some image files in one of the directories that is giving me trouble (most seem to have one of these two permissions set):

```
-rwxrwxr-x 1 apache apache   42206 Mar 22  2008 file1.gif

-rw-rw-rw- 1 apache apache   63804 Jul 25  2008 file2.gif
```

----------

## SweepingOar

Bump.

----------

## jongeek

Can you post the output from rsync, so we can see the exact error messages ?

----------

## SweepingOar

There are a ton of lines like the first few here and they exceeded my scrollback, but this is the end of the session:

```
rsync: mkstemp "/www/victor/public/images/photos/full/.snake87.jpg.zIBGso" failed: Permission denied (13)

rsync: mkstemp "/www/victor/public/images/photos/full/.snake89.jpg.2tAbHb" failed: Permission denied (13)

rsync: mkstemp "/www/victor/public/images/photos/full/.snake98.jpg.ueA2XY" failed: Permission denied (13)

rsync: mkstemp "/www/victor/public/images/photos/full/.sword13.jpg.hytmkM" failed: Permission denied (13)

rsync: mkstemp "/www/victor/public/images/photos/full/.sword14.jpg.y2LXLz" failed: Permission denied (13)

rsync: mkstemp "/www/victor/public/images/photos/full/.sword15.jpg.lYuIin" failed: Permission denied (13)

victor/scripts/update/avData.txt

victor/scripts/update/compare.txt

victor/scripts/update/newData.txt

victor/scripts/update/missing.txt

victor/scripts/video/delete.txt

sent 95031 bytes  received 29935644 bytes  245148.37 bytes/sec

total size is 2443586854  speedup is 81.37

rsync error: some files could not be transferred (code 23) at main.c(1524) [generator=3.0.3]

$ 

```

The permission of the photos/full folder is:

```
drwxrwxr-x 2 apache apache 
```

The permissions of the files all seem to be:

```
-rw-rw-rw-
```

...and they're owned by the user I'm connecting as, not apache. Very strange.

----------

## SweepingOar

In trying to get this to work, I thought that maybe removing the "o" flag (preserve owner) might help, but it didn't. I tried chmod'ing one of the trouble files to be executable by owner (I was connecting as owner), but that didn't help.

The only way that I was able to get the error to go away was by running the rsync command as root.I don't know what the issue is, but that seems to work. I don't like running a backup as root, but I guess it will have to do for now.

----------

