I have to change the permissions of the htdocs
directory in apache to a certain group and with certain read/write/execute.
The directories need to have 775 permissions and the files need to have 664.
If I do a recursive 664 to the htdocs
, then all files and directories will change to 664.
I don't want to change the directories manually.
Is there any way to change only files or directories?
chmod
can actually do this itself; the X
symbolic permission means "execute, if it makes sense" which generally means on directories but not files. So, you can use:
chmod -R u=rwX,go=rX /path/to/htdocs
The only potential problem is that if any of the plain files already have execute set, chmod
assumes it's intentional and keeps it.