Can I set the permissions on a symbolic link under Linux/UNIX?

last updated in Categories

No, you cannot. If you try to execute chmod command on a symbolic link, it will return with error Changing permissions of `filename’: Operation not permitted. This is quite logical, as permission on a symbolic link is meaningless. The only thing is important is permission on the file that the link points. In short, permissions on a symbolic link do not really mean anything.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

4 comment

  1. soft links permissions are only for renaming the soft link and removal of the link itself thus the 777 permissions are not at all valid for changing the contents of the original file, or changing the contents of the file it shows through the cat command

  2. you can set with recursive option of ‘chown’; note that this will change the target permissions as well.

    bash$ chown -R root:root

  3. Hi, the webhost we are using disallows 0777 on directories which basically prevents me from using symbolic links on www/ dir, what can we do about this? not use symlink at all?

    Still, have a question? Get help on our forum!