Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why won chmod change the permissions on symlinks?

chmod permissions symlinks
0
Posted

Why won chmod change the permissions on symlinks?

0

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.

0

You have to use either “-H” or “-L” together with the “-R” option to make this work. See the chmod and symlink man pages for more info. WARNING the “-R” option does a RECURSIVE chmod. Be careful about specifying directories or symlinks to directories to chmod. If you want to change the permissions of a directory referenced by a symlink, use chmod 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 will follow the symlink, “foo”, to change the permissions of the directory, “bar”.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123