# Can you explain this to me #ln -s :“target is not a directory”?

I'm doing this:

sudo ln –s /etc/apache2/sites-available/LoginProject /etc/apache2/sites-enabled/LoginProject


And I get:

ln: target /etc/apache2/sites-enabled/LoginProject' is not a directory


edit:

this command:

ls -l /etc/apache2/sites-enabled/LoginProject /etc/apache2/sites-available/LoginProject


outputs:

ls: cannot access /etc/apache2/sites-enabled/LoginProject: No such file or directory
-rw-r--r-- 1 root root 526 2011-09-27 18:40 /etc/apache2/sites-available/LoginProject


edit 2:

$ls /etc/apache2/sites-available/ default default-ssl LoginProject$

$ls /etc/apache2/sites-enabled/$

-
Can you add the ls -l /etc/apache2/sites-enabled/LoginProject /etc/apache2/sites-available/LoginProject output? –  Belmin Fernandez Sep 27 '11 at 23:08
sure, there I added it –  fceruti Sep 27 '11 at 23:11

Try: sudo a2ensite LoginProject

You could also do sudo ln –s /etc/apache2/sites-available/LoginProject /etc/apache2/sites-enabled/

-
The file is: /etc/apache2/sites-available/LoginProject Anyway, I tried changing the order, and didn't worked –  fceruti Sep 27 '11 at 23:22
Sorry that was wrong, see edit –  xofer Sep 27 '11 at 23:23
Thanks! the a2ensite LoginProject worked! didn't tried the other command. It's still very weird... I really don't get it –  fceruti Sep 27 '11 at 23:27
Normally, ln accepts 2 file paths and if it is more than two, the target must be a directory. I still wonder why it counts your parameters like this way!!! –  SparX Sep 27 '11 at 23:33

Try ln with single argument like below and see whether it helps,

cd /etc/apache2/sites-enabled/ ; sudo ln -s /etc/apache2/sites-available/LoginProject

-

You probably copied and pasted the ln -s command from another source and the system inserted the wrong type of -. Try deleting the - and typing it again manually.

-

Try quoting the directories and terminating the sudo command arguments like so:

sudo -- \ln –s "/etc/apache2/sites-available/LoginProject" "/etc/apache2/sites-enabled/LoginProject"

-
Nope, this didn't make the trick –  fceruti Sep 27 '11 at 23:21
Made an edit. Try it again now. –  Belmin Fernandez Sep 27 '11 at 23:24
I copy pasted that and got: ln: target /etc/apache2/sites-enabled/LoginProject' is not a directory –  fceruti Sep 27 '11 at 23:25
Man. I'm stomped. I've only seen that when the target exists. But your ls output shows that it does not. Wondering if it's an SELinux or ACL issue of some kind. Meh, you got it to work with @fuscata's answer. Good job :-) –  Belmin Fernandez Sep 27 '11 at 23:27
Thanks for your time man, @fuscata got a solution, maybe not an answer to why that happend, but still... thanks again –  fceruti Sep 27 '11 at 23:28