How do I specify folders only for chmod
5,277
Unless you delibaretely not want the group members to access the directory (will be a unusual case), you should use 755
for directories.
You can use find
.
For files :
find /path/to/public_html/ -type f -exec chmod 0644 {} +
For directories (using 755) :
find /path/to/public_html/ -type d -exec chmod 0755 {} +
-type f
will only find the files and executechmod 0644
accordingly-type d
will find the directories only and executechmod 0755
on them.
Related videos on Youtube
Author by
j0h
been using Linux since 2005. Ubuntu since whenever edgy eft was new. Lucid Lynx Ubuntu was the best Ubuntu I have ever used.
Updated on September 18, 2022Comments
-
j0h over 1 year
I have a 30GB website, with loads of folders, and files. I want all the folders to have the permission 745 and all the files to have 644. I tried using
chmod -R 745 public_html/
but all the sub files get that permission. How can I change all the folders (only) to this permission with chmod?-
Rinzwind over 8 years
-
Rinzwind over 8 years745 is a typo I hope...
-