Knowledge Base

How to set CHMOD for a folder and all of its subfolders and files in Linux

Do you want to set the directories to 755 and/or set files to 644.
For this, you can use the find command. For example:
To change all the directories to 755 (-rwxr-xr-x):
$ find /opt/lampp/htdocs -type d -exec chmod 755 {} \;
To change all the files to 644 (-rw-r--r--):
$ find /opt/lampp/htdocs -type f -exec chmod 644 {} \;
Please rate this article to help us improve our Knowledge Base.

0 0