Rsyncd and Environmental Paths
Matt McCutchen
matt at mattmccutchen.net
Mon Mar 16 22:15:39 GMT 2009
On Mon, 2009-03-16 at 16:43 -0400, Jerome Hollon wrote:
> I have this in my rsync.conf
> [backup]
> path = /home/$USER/backup
> use chroot = no
> monge symlinks = no
> uid = wendell
> gid = wendell
> read only = no
> list = yes
> auth users = wendell
> secrets file = /etc/rsyncd.secrets
> But rsync doesn't seem to interpret the $USER. I've also tried this
> with $HOME and '~' with no luck. I want to be able to back up to the
> folder 'backup' that will be in the users homefolder when a user is
> backing up remotely to the rsync daemon.
>
> How can I do this?
Rsync does not perform any kind of expansion on module paths. The $USER
environment variable would not be useful anyway (at least for a
listening daemon) because it refers to the user running the daemon, not
the client.
IMO, having a module do completely different things depending on who
accesses it is dodgy. I recommend using a separate module for each
user. You can generate the configuration automatically with m4:
define(`module', `
[backup-$1]
path = /home/$USER/backup
use chroot = no
monge symlinks = no
uid = $1
gid = $1
read only = no
list = yes
auth users = $1
secrets file = /etc/rsyncd.secrets
')
module(`wendell')
module(`jerome')
(See also
http://lists.samba.org/archive/rsync/2007-January/017014.html .)
If your users have unrestricted shell accounts on the backup server, it
may be appropriate to use plain rsync over ssh rather than a daemon.
--
Matt
More information about the rsync
mailing list