tags:

views:

763

answers:

2

I'm trying to use rsync to backup windows servers to an rsync server. I'm having problems with rsync on the linux side though, it doesn't like symlinks.

Currently I'm trying to use the module path of ~/backup, but rsync says that the chroot failed. I looked up what to do and saw that I needed to add the option use chroot = no and munge symlinks = no. That fixed the @ERROR: chroot failed but now it's telling me @ERROR: chdir failed and the log files say that there is no ~/backup directory. I know the user I'm authenticating with has a backup folder in his directory.

How can I fix this?

For reference I'm using a .NET port of rsync called NetSync and tunneling it over a port forwarded SSH connection generated with granados.

A: 

I suspect that the ~ may not be being globbed correctly. Two ideas:

  1. ~ refers to the current user's home (what user are you authenticating as?). Did you mean ~user/backup?

  2. Perhaps it's the ~ that's causing problems. Test with the full absolute path, eg /home/user/backup.

Martin Carpenter
Because a absolute path would defeat the purpose. I need the user's home directory because I want rsync to back up to the user that logged in.
Malfist
I did say "Test with...".You could make this a two-stage operation, get home directory first (less clean) with: "ssh username@host getent passwd username | cut -f7 -d:".Or hack rsync and put in a call to glob(3).
Martin Carpenter
A: 

IIRC, tilde (~) expansion is done by the shell. chdir() doesn't handle this.

Try an absolute path. If you don't like that, then try using "backup" (or ./backup) on the assumption that after login, the current directory will be set to the user's home directory.

jdigital
Because a absolute path would defeat the purpose. I need the user's home directory because I want rsync to back up to the user that logged in.
Malfist
Did you try the other suggestion (./backup)?
jdigital
yes, 2.6.9 doesn't support relative paths. 3.0.0+ does, however the path will be relative to where the rsync daemon was executed from. I.E. not the user.
Malfist
Hmmm, I just checked my rsync script and it uses a relative path with no problem at all. The client is rsync 2.6.6 (it came with DeltaCopy), host is some kind of Linux. I suggest double checking your assumptions about the default directory,
jdigital