5

chown has an option -L which tells chown to traverse symbolic links. It seems this option is missing for chmod. Any idea how to tell chmod to follow symlinks as well?

EDIT: I'm on Debian.

  • You should mention that it's Linux or some other system. I was confused because FreeBSD has got -L for both commands. – Martin Sugioarto Sep 15 '16 at 18:29
  • true, I'm on Debian. – Aley Sep 16 '16 at 9:49
5

For Linux/GNU see the second paragraph of the info page also on the Web, emphasis added:

chmod never changes the permissions of symbolic links, since the chmod system call cannot change their permissions. This is not a problem since the permissions of symbolic links are never used. However, for each symbolic link listed on the command line, chmod changes the permissions of the pointed-to file. In contrast, chmod ignores symbolic links encountered during recursive directory traversals.

| improve this answer | |
  • 3
    Okay so chmod ignores symbolic links encountered during recursive directory traversals. So chmod is not capable of it. So propably I have to use find -L in combination of chmod. – Aley Sep 18 '16 at 17:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.