I'm wondering how to create in linux something like symbolic link, that wil point to different directories for different users seeing it. I was searching for long time for itand found something called hlfsd - Of course common symlinks cannot do this,because they base on kernel "stuff", but I've found something that may solve this problem.

But, is there any "better" solution - anythong that will give me link-like file, that will point to different directories based on f.e. user's id?

Basically what I want to do:

Lets consider we have server with file structure A/{a1 a2}/{b1 b2}/{c1 c2} inside of these folders, there are large files and should not be copied over the network. Lets say user U1 wants to access these files, so he can make symlink (so far so good).

The problem is, when he wants to access this structure and he wants to have locally copy only of for example A/a1/b1/c1. Of course we can make a lot of symlinks locally, that will point to those folders on server, but then we have no one very important to me feature - when somebody for example adds folder A/a1/b1/c3, then this user, that was linked to this file structure and have A/a1/b1/c1 locally, will not see the changes, because all his links were created manually.

  • I don't understand how your use case relates to your question. Why should different users see different contents for the same file/directory? Is the fact that the files are remote important? How much is user convenience and how much is security? Perhaps AFS or FUSE may be of interest to you. Dec 4, 2010 at 14:18

2 Answers 2


FreeBSD used to have some special symlink handling, I think called variadic symlinks (though a Google search of that term doesn't find what i wanted). The idea that you don't symlink to a specific path, but a string that can have replacements.

Not only are you screwed in that Linux doesn't support this, but it's harder to implement per user stuff than you think. In *BSD, it was made to do symlinks for simple strings that the kernel would know about, like architecture (i.e. i686 vs. x86_64). Then a symlnik from /opt/someapp/bin => /opt/someapp/${arch}/bin makes some sense. But you want to do per user. Remember that symlinks are resolved in the kernel, and the kernel doesn't know your name, or home dir. It knows your userid, and that's about it. It would have to jump back and forth to user mode to get any info about you. Not impossible, but very tricky. Then, how would setuid programs work?

In short, I know what you mean, know what you want, but you're unlikely to get there. Maybe check out fuse and see if they have anything you can use.

Not quite what you said, but maybe you can do this with source control. ClearCase (payware) used to have a kernel module that would do most of what you want, not sure if it still does. Even without a kernel filesystem module, you can probably bang distributed source control into 60-70% of what you want.


The simple solution I see is that in each folder there is hidden folder .realfiles in which real folders are and folders on the server like A/a1 or A/a1/b2 are symlinks to folder above A, so A/a1 is symlink to ../MOUNT/.realfiles/a1 and A/a1/b2 is symlink to ../MOUNT/.realfiles/a1/.realfiles/b1.

Now basically the MOUNT on the server is symlink to A. but if it will be possible to change per-user links, that for each user the MOUNT folder will point another directory, then we will be able to change some links as we want.

(I know this special situation, but I did best to explain it good)

  • @wdanilo I did the best I could to try to separate the answer from the question. If you ever return back, post an answer drop me an @sathya so that I can delete this.
    – Sathyajith Bhat
    Dec 4, 2010 at 3:55
  • HI! The problem is that this is not the answer :( This is general solution, that would work If I would be able to create symlinks "per user". So symlink "MOUNT" would point to another place for each user :(
    – wdanilo
    Dec 4, 2010 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.