0

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.

  • 1
    Do you have write permission for the folder the symbolic link resides in? – Seth Oct 29 '18 at 12:47
  • In the above example, which folder are you referring to? /usr/bin/? – Neon Flash Oct 29 '18 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 '18 at 6:16

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.