Link file not opening on webserver

Tim ignored_mailbox at yahoo.com.au
Sat May 26 01:32:35 UTC 2007


Paul Ward:
>>>> I used the following to link the file which worked fine.
>>>
>>>>  # ln -s myfile /var/www/html/

Tim:
>>> That's linking a file to a directory?

Neil Cherry:
>> No it's a link to a file, it's in that directory because the
>> directory already exists. The file name will be myfile.

Try it, there's something wrong with the construction of that command
line.

>From the man file:
       ln [OPTION]... [-T] TARGET LINK_NAME   (1st form)
       ln [OPTION]... TARGET                  (2nd form)
       ln [OPTION]... TARGET... DIRECTORY     (3rd form)
       ln [OPTION]... -t DIRECTORY TARGET...  (4th form)

It looks a malformed command, to me.  If I try it, as root (as only root
has write permissions for /var/www/html), while in root's homespace, or
in /var/www/html/, I get this:

[root at serge ~]# ln -s myfile /var/www/html/
[root at serge ~]# ls -l /var/www/html/
total 4
lrwxrwxrwx 1 root root 6 May 26 10:48 myfile -> myfile

That's a symlink from a symlink to itself.

The original command example supplied creates a link to a target called
"myfile" with a link name of "/var/www/html".

Reversing it:
[root at serge ~]# ln -s /var/www/html/ myfile

Creates a myfile link in the homespace, that points to
the /var/www/html/ directory.  In essence, a "myfile" directory that
leads as a shortcut to the /var/www/html/ directory.

Aaron Konstam:
> When I try the above ln command on my machine indeed a file is created
> in the directory. But if I go to the directory and do a ls myfile
> I get an error as follows:
> 
> ls: myfile: Too many levels of symbolic links

I get a different set of errors, ones that I observe myself.  The
command apparently runs without generating an error message.  But it
creates a daft link (one to itself).

-- 
(This box runs FC6, my others run FC4 & FC5, in case that's
 important to the thread.)

Don't send private replies to my address, the mailbox is ignored.
I read messages from the public lists.





More information about the users mailing list