mounted nfs share, cannot access symlinked files
Karl Auer
kauer at biplane.com.au
Fri Oct 8 23:56:50 UTC 2021
On Sat, 2021-10-09 at 00:53 +0200, Bo Berglund wrote:
> At least this is what I think is happening since it seems to try
> accessing the symlinked file on the *client* machine's ~/bin dir,
> where it does not exist.
Here's an analogy: Suppose you have put a nice dinner in the oven for
your extremely literal-minded partner. Your partner, who is visiting a
friend, telephones you and says "where is dinner?". And you reply "it's
in the oven". So your partner goes to the oven in the friend's kitchen
- and finds no dinner.
A symlink is just a name. Whatever that name is *in context* will be
used as the real file. So if you set up a symlink to e.g.
"/usr/bin/whatever" but use that symlink via NFS, then your local
system will look for /usr/bin/whatever *locally* - like your partner
looking in the local oven instead of the remote oven.
Things like "~" are dereferenced by the shell when used, so you will
never see a tilde in an actual symlink. The tilde will have been
replaced by the actual path to the user's home directory. If you
symlink to a file in a user's home directory on the server, then mount
the filesystem with the symlink across NFS and that user does not exist
locally, you'll get "not found". If the same user exists locally, but
does not have that file, you'd also get "not found". If the local user
exists and has a file of that name, then the *local* version of the
file will be referenced.
> On the server I wanted to make the scripts available to the clients
> so they could be easily copied over, but at the same time I did not
> want there to be *copies* of the scripts floating around on my
> server. Hence the symlink solution.
One option to avoid copies would be to use hard links instead of
symbolic links. Then the actual server-side scripts would be visible to
and usable by your NFS clients. A suggest you read about hard links
first though. In the analogy above, a hard link is a wormhole in the
spacetime continuum, so that the oven in your home is the *exact same
actual oven* as the one in your partner's friend's kitchen :-)
> Is there some flag that will hide symlinks from connected clients?
Do you want your NFS clients to be able to see these scripts or not?
Regards, K.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au)
http://www.biplane.com.au/kauer
GPG fingerprint: 61A0 99A9 8823 3A75 871E 5D90 BADB B237 260C 9C58
Old fingerprint: 2561 E9EC D868 E73C 8AF1 49CF EE50 4B1D CCA1 5170
More information about the ubuntu-users
mailing list