I need to have a module that saves the files to ~/backup, and the rsync complains that the path does not exist for ~/backup, $HOME/backup, and for /home/$USER/backup. The error is chdir failed, no such directory.
Indeed, environment variables are not recognized in the module path; that would be an enhancement.
This is being discussed on the list:
The git repository now supports the expansion of environment variables using %VAR% references. I chose this idiom because I thought it would be less likely to have backward-compatibility issues, and it also stays with the DOS/Win style of the config file.
You can reference environment variables in the values of settings only, which does not include module names or parameter names. All string values are evaluated late so that they can include the variables listed in the manpage section describing the pre-xfer exec scripts. Values that are not strings (such as "use chroot = BOOL") are expanded at config-reading time so that the parameter can be set with the appropriate value type.
So, to get the authenticating user into a path as you requested (and indeed, even into a uid setting) you can do things like this:
path = /home/%RSYNC_USER_NAME%
uid = %RSYNC_USER_NAME%
gid = *
auth users = sally susan sam steve
One thing you can't do is this:
secrets file = /home/%RSYNC_USER_NAME%/.rsync-secret
That's because the needed environment variable isn't set until after the name and password has been validated.