How to tell chmod to follow symbolic links?

4

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.

Aley

Posted 2016-09-15T13:33:19.427

Reputation: 226

You should mention that it's Linux or some other system. I was confused because FreeBSD has got -L for both commands. – Martin Sugioarto – 2016-09-15T18:29:04.070

true, I'm on Debian. – Aley – 2016-09-16T09:49:10.040

Answers

4

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.

dave_thompson_085

Posted 2016-09-15T13:33:19.427

Reputation: 1 962

3Okay 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 – 2016-09-18T17:19:53.827