Symlinks do not have permissions, and by default, chmod(1) will not follow symlinks to change the permissions on the target file. So if you have a file, foo, and a symlink to that file, bar, then this command will always succeed.
% chmod g-w bar
However, the permissions on foo will not have changed.
You have to use either -H or -L together with the -R option to make this work. See the chmod(1) and symlink(7) man pages for more info.
Warning: The -R option does a RECURSIVE chmod(1). Be careful about specifying directories or symlinks to directories to chmod(1). If you want to change the permissions of a directory referenced by a symlink, use chmod(1) without any options and follow the symlink with a trailing slash (/). For example, if foo is a symlink to directory bar, and you want to change the permissions of foo (actually bar), you would do something like:% chmod 555 foo/
With the trailing slash, chmod(1) will follow the symlink, foo, to change the permissions of the directory, bar.
|UNIXguide.net||Suggest a Site|