1

There's a symbolic link on my Linux machine which I want to update and point it to another location however I get permission denied error even though I have rwx permissions for the symbolic link:

$ ls -l /usr/bin/upgrades
lrwxrwxrwx 1 root root 18 Feb 16  2015 /usr/bin/upgrades -> upgrade

Here, /usr/bin/upgrades is a symbolic link to /usr/bin/upgrade which is a python script.

now, I want to point this symbolic link to another Python script in my home directory as shown below:

ln -sf test.py /usr/bin/upgrades

ln: cannot remove ‘/usr/bin/upgrades’: Permission denied

So, why do I get a permission denied error and also is there a way to update the symbolic link and point it to another location? I have rwx access to the symbolic link.

3
  • 1
    Do you have write permission for the folder the symbolic link resides in?
    – Seth
    Oct 29, 2018 at 12:47
  • In the above example, which folder are you referring to? /usr/bin/?
    – Neon Flash
    Oct 29, 2018 at 13:46
  • Yes. You need to have permissions to change the "index" of /usr/bin in order to remove a file/add a file to that directory. If you look at the output of ln it seems likely that it just removes the existing link and adds a new one afterwards.
    – Seth
    Oct 30, 2018 at 6:16

0

You must log in to answer this question.

Browse other questions tagged .