0

Im trying to rsync via commander product and getting error following error.

Command used is

rsync -arv -K -O --no-perms --delete --exclude=.svn --exclude=.snapshot sourcepath svn@ServerB:/tasks

Falling files are not owned by svn user but they are writable by svn user's primary group.

if i try login to serverB as svn user im able to edit these files. Only rsync fails.

WE can't change the ownership of the files as webapp needs to be in different account.

Following is the error message.

rsync: mkstemp "/tasks/com/media/.QuerySM.task.Yz4zVg" failed: Permission denied (13)
rsync: mkstemp "/tasks/com/media/.QuerySP.task.eqoVbP" failed: Permission denied (13)
rsync: mkstemp "/tasks/com/media/.QueryST.task.8c1Gsn" failed: Permission denied (13)
rsync: mkstemp "/tasks/com/media/.QueryMW.task.Q18EFI" failed: Permission denied (13)
rsync: mkstemp "/tasks/com/parts/.EFParts.task.0sJVJV" failed: Permission denied (13)
rsync: mkstemp "/tasks/com/parts/.FFModel.task.y6UF1t" failed: Permission denied (13)

rsync version

   rsync  version 3.0.6  protocol version 30

Directory permission is 775.

Interesting thing i found now is it throws this error but it actually copies the file and ends with below error.

      sync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1039) [sender=3.0.6] 
maestromani
  • 841
  • 1
  • 9
  • 31
  • Possible duplicate of [rsync - mkstemp failed: Permission denied (13)](http://stackoverflow.com/questions/11039559/rsync-mkstemp-failed-permission-denied-13) – Maquefel Jan 21 '16 at 10:54
  • @Maquefel, solutions didn't help me :-(. I can't make svn user as owner as webapp will fail – maestromani Jan 21 '16 at 10:55
  • what is your rsync version? And what is your persmission for group for the directory? Can you create new files as svn? – Maquefel Jan 21 '16 at 11:02
  • @Maquefel, added now in the original post. 3.0.6 is the version and 775 is the permission. – maestromani Jan 21 '16 at 12:27
  • No idea then, you can try elevating http://www.linuxquestions.org/questions/linux-server-73/rsync-permission-denied-906421/ or you can try adding --in-place option – Maquefel Jan 21 '16 at 12:37
  • Who owns `/tasks/com/{media,parts}` ? – ghoti Jan 21 '16 at 12:51
  • @ghoti,Owned by webapp account, webapp group which owns that is primary group of svn account. – maestromani Jan 21 '16 at 13:32
  • And when you say "*Directory permission is 775*", are you referring to just `/tasks/com`, or `media` and `parts` as well? – ghoti Jan 21 '16 at 14:14
  • @ghoti, task directory permission and all the directories and files underneath got 775 permission. – maestromani Jan 21 '16 at 15:01

1 Answers1

0

If your 'svn' user does not have write access to parts of the directory it's responsible for, start by fixing those permission problems. I would guess that the issue is lack of write permission to /tasks/com and /tasks/parts, so on serverB:

chown svn /tasks/com/{media,parts}

Next, if you're comfortable with the (serious) security issues with this, you might be able to bypass permission problems by running rsync as root:

rsync [other options] --rsync-path="sudo rsync" sourcepath user@serverB:/path/

This --rsync-path option tells rsync to run rsync as root on remote servers (source or target). To use this, you will need to set up sudo on serverB so that your user receives no password challenge when trying to run rsync.

BE AWARE THAT THIS IS A RISK. Rsync can do many things, and granting rights like this pretty much grants root access to anyone who can get a shell on the server.

ghoti
  • 45,319
  • 8
  • 65
  • 104