LinuxSA Mailing list archives

Index: [thread] [date] [subject] [author] [stats]
  From: Richard Russell <richardrussell@internode.on.net>
  To  : <lloy0076@rebel.net.au>
  Date: Wed, 04 Jul 2001 00:02:10 +0930

RE: Basic NFS Question

> However, I could symlink to the directory (crazy; I can create symlinks
> that I clearly was not permitted to use).

for the benefit of those who are new to symlinks:

symlinks are nothing more than text -- this means you need to think a little
harder when creating them, especially when using relative paths...

eg: try something like:

$ pwd
/tmp
$ mkdir test_dir
$ cp ~/.profile test_dir/a_file
$ ln -s test_dir/a_file test_dir/another_file
$ ln test_dir/a_file test_dir/yet_another_file
$ cd test_dir
$ ls -l
-rw-r-----  <blah> a_file
lrwxrwxrwx  <blah> another_file -> test_dir/a_file
-rw-r-----  <blah> yet_another_file
$ cat another_file
cat: cannot open another_file
$ cat yet_another_file
<blah>
$

I hope this is clear...

Basically a symlink is always interpreted as a textual relative path from
the symlink itself. A hardlink, of course, is a reference to the inode, and
is indistinguishable from the original filename...

Of course, this also means that there is no reason that a symlink needs to
make any sense whatsoever... the link could have anything that can be in a
filename, whether it's "legal" or exists, or whatever...

Also note that symlinks are not interpreted by the NFS daemon (I think
someone already made this point, but that won't stop me!). This means that a
symlink on an exported fs cannot reference something on that server's file
tree -- it's interpreted by the client, and then that file is looked at from
the client's perspective, so /export/home/richard/tmp -> /tmp points to /tmp
on whatever machine I am on at the time, not /tmp on the server.

rr


-- 
LinuxSA WWW: http://www.linuxsa.org.au/  IRC: #linuxsa on irc.linux.org.au
To unsubscribe from the LinuxSA list:
  mail linuxsa-request@linuxsa.org.au with "unsubscribe" as the subject


Index: [thread] [date] [subject] [author] [stats]
Return to the LinuxSA Mailing List Information Page