0

I'm trying to create a symlink but ln says it exist. I cannot see it in FTP and the cd gives me an error.

[root@vps82008 addons]# ln -s /root/sendsms/app/addons/sendsms /var/www/html/modul-cscart.com/public_html/app/addons ln: failed to create symbolic link ‘/var/www/html/modul-cscart.com/public_html/app/addons/sendsms’: File exists [root@vps82008 addons]# cd /var/www/html/modul-cscart.com/public_html/app/addons/sendsms -bash: cd: /var/www/html/modul-cscart.com/public_html/app/addons/sendsms: No such file or directory 

1 Answer 1

1

Hypothesis: /var/www/html/modul-cscart.com/public_html/app/addons/sendsms is a symlink with nonexistent target.

cd says No such file or directory because the target doesn't exist. Still the symlink itself does exist, that's why ln says File exists. I guess maybe your FTP server is configured to ignore invalid or all symlinks.

Run the following command to confirm the hypothesis:

ls -ld /var/www/html/modul-cscart.com/public_html/app/addons/sendsms 

If the symlink exists, just remove it before you proceed with ln -s … to create it anew (with a proper target this time); or use ln -s -f … to make ln overwrite it without complaining.

Warning: Removing or overwriting something else than a symlink may cause data loss. Removing or overwriting a symlink discards information what its target was. Make sure you know what the file really is. Aside from the above ls -ld … command, use file (if available):

file /var/www/html/modul-cscart.com/public_html/app/addons/sendsms 

This tool should explicitly tell you the link is broken, if this is the case.


My attempt to replicate the problem:

$ mkdir /tmp/test608752 $ cd /tmp/test608752 $ ls $ ln -s foo bar $ ln -s /tmp bar ln: failed to create symbolic link 'bar': File exists $ cd bar -bash: cd: bar: No such file or directory $ ls -ld bar lrwxrwxrwx 1 kamil kamil 3 Sep 10 12:04 bar -> foo $ 
5
  • this is the output lrwxrwxrwx 1 root root 39 Sep 10 08:30 /var/www/html/modul-cscart.com/public_html/app/addons/sendsms -> /root/sendsms_module/app/addons/sendsms Commented Sep 10, 2020 at 10:10
  • @RaduCatalin Exactly. And I guess /root/sendsms_module/app/addons/sendsms does not exist. Please confirm. Commented Sep 10, 2020 at 10:15
  • I cannot see it in my ftp. But if I type ls -a I see it but with a red color instead of a blue one like the other folders Commented Sep 10, 2020 at 10:17
  • @RaduCatalin Can you use file? file /var/www/html/modul-cscart.com/public_html/app/addons/sendsms will explicitly tell you the link is broken, if this is the case. Commented Sep 10, 2020 at 10:28
  • Red color means the target of the link doesn't exist. So /root/sendsms_module/app/addons/sendsms does not exist. Commented Sep 10, 2020 at 12:51

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.