Linux: Set permission only to directories

后端 未结 6 1837
盖世英雄少女心
盖世英雄少女心 2021-01-30 07:07

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

6条回答
  •  孤城傲影
    2021-01-30 07:41

    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.

提交回复
热议问题