# How shadow a file to point to something else?

Case:

• VirtualBox doesn't support Windows' symlink to be shared with host (Linux).
• actually a physical folder which contains the link is share. Everything except the symlink can be accessed.
• Have a symlink in that folder is currently the easiest for my purpose (describing the situation is not feasible). Other options are too length and chances of error are high.
• when the VB shared folder is mounted (sudo mount -t vboxsf foo /home/apache/foo -o rw) the symlink (bar) it contains is listed but it's content can't be viewed. file /home/apache/foo/bar returns an error saying something like

/home/apache/foo/bar: broken symbolic link to X:\foo\bar'

What I can do is VB share the link to which bar links to and mount it at say ~/mounts/bar.

Question:

How can I shadow ~/foo/bar so that it actually acts as a proxy to ~/mounts/bar? In essence shadowing ~/foo/bar.

That way if the host (Windows) shares foo on it's network, it's clients will be able to access the content of foo/bar and the host VB machine would indirectly read/write to ~/mounts/bar while pointing at ~/foo/bar. Actually the application expects one base data directory not multiple.

-
You could mount it as a CIFS share. Or, are you looking for a symlink? – Elliott Frisch Mar 19 '14 at 15:37
symlink didn't work, returned some read-only file-system error. Are we allowed to have nested mounting? i.e. mount inside a mounted location. Haven't tried it. – Bleeding Fingers Mar 19 '14 at 15:40
Yes. As long as the mount point is an empty folder, or a UnionFS. – Elliott Frisch Mar 19 '14 at 16:33
I can't comment on that until I've tested it. Would it do if the mount point is a broken symlink? – Bleeding Fingers Mar 19 '14 at 17:04
Nope it doesn't mount: mount point bar is a symbolic link to nowhere. bar` is an arbitrary broken symlink I created. – Bleeding Fingers Mar 19 '14 at 17:09