D
D
doroshchenco2022-02-08 16:35:40
linux
doroshchenco, 2022-02-08 16:35:40

Why does an error occur when creating a symbolic link?

Hello!

I'm trying to create a symbolic link, but I'm getting the following error:

ln: failed to create symbolic link '/etc/nginx/sites-enabled/doroshchenko.xyz.conf': File exists


What I did before:
1) created folders with configs
mkdir -p /etc/nginx/sites-available/
mkdir -p /etc/nginx/sites-enabled/

2) edited the config:
nano /etc/nginx/sites-available/doroshchenko.xyz.conf

3) trying to do:
ln -s /etc/nginx/sites-available/doroshchenko.xyz.conf /etc/nginx/sites-enabled/

And I get an error:
ln: failed to create symbolic link '/etc/nginx/sites-enabled/doroshchenko.xyz.conf': File exists


Why is this happening and how to fix it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
vreitech, 2022-02-08
@fzfx

Do you already have the /etc/nginx/sites-enabled/doroshchenko.xyz.conf file at the time of running the symbolic link command? As if there is, you need to add the -f option to the command if you want it so that if a file with the same name already exists, it will be overwritten.

V
Vladimir Yurchenkov, 2022-02-08
@EPIDEMIASH

It happens because of two dots or when links are placed incorrectly in places. Moreover, he informs you that the link, they say, already exists.
Tried --force, with an explicit indication.
ln -sf /etc/nginx/sites-available/doroshchenko.xyz.conf /etc/nginx/sites-enabled/doroshchenko.xyz.conf

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question