12

I have access to a remote Linux machine where every time I create a symbolic link, it is created by default with the following permissions: lrwxrwxrwx

If I try to change the permissions of the symbolic link (i.e. not the path that it points to) using for example:

chmod g-w my_symbolic_link

chmod runs correctly (no error message is printed) but when I check the permissions again, they are still the same (lrwxrwxrwx).

I am waiting to hear from the machine administrator, but I was wondering if this is normal behavior, or if it is something specific to the box.

1 Answer 1

17

It's normal behavior. What happens can vary depending on the operating system (Solaris at least used to change the link permissions); but since a symlink isn't a normal file, the permissions don't actually get used for anything. (File permissions are part of the file's inode, so the symlink can't affect them.)

2
  • I see, thanks. I just want to prevent anybody from deleting the symbolic link. From what I understand then I cannot change the permission of this link without the help the administrator, correct? Commented May 6, 2011 at 19:48
  • 4
    Not even with the administrator's help. File deletion depends on the permissions of the containing directory, not on those of the file. (rm specifically checks the file for read-only unless you pass -f, because one usually doesn't intend a read-only file to be deleted, but unlink() doesn't care. Try it from Perl or Python sometime.)
    – geekosaur
    Commented May 6, 2011 at 19:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .