symlinks and different $HOME variables

Christopher Brace clbrace at
Thu Feb 15 15:34:43 GMT 2007

On Wed, 2007-02-14 at 20:33 -0500, Matt McCutchen wrote:
> I assume you mean that the symlinks in /home/laptop/ point to files in
> /data/ and you want them to point to the corresponding files in
> /home/laptop/ .  The obvious fix is to use relative symlinks instead
> of absolute ones.

Exactly, I didn't even consider this.  It works perfectly!

> Do you really want $HOME?  I thought $HOME on the desktop was
> /remote/home/desktop/ , but the symlinks point into /data/ .  Anyway,
> the answer is no: no filesystem I know of supports symlinks relative
> to environment variables, and rsync doesn't support rewriting symlinks
> paths.  But maybe ordinary relative symlinks (which are relative to
> the directory containing them) will do what you want.

OK, thanks.  My setup is a little confusing because I have this remote
home directory that gives me only a few hundred MB of space, but most
applications default to the home directory for saving, opening, etc.
So, I have symlinks in the home directory pointing to the things I need
on /data/. The result is, if symlinks were real directories, the home
directories of each machine look pretty much the same.

> I don't understand exactly what you are trying to do (an example might
> help), but I have a guess.  To make rsync follow a few specified
> symlinks to directories (but not other symlinks) in the source, use
> --relative and list each symlink to follow as a source argument with a
> trailing slash.  For example, if you want rsync to copy src/ to dest/
> , following the symlink at src/link1 , do this:
> rsync -rl --relative src/./ src/./link1/ dest/

Thanks for the tip.  I actually found it easier to use the --files-from
option... that option wasn't working when I wrote the first message
because of a syntax mistake. It's working perfectly now.  Thanks again.

More information about the rsync mailing list