Press "Enter" to skip to content

Tag: recursive chmod

Techy: Recursive CHMOD of Folders

I’m currently in the midst of moving a large number of websites from one Red Hat Linux web server (an Ensim machine) to another Red Hat Linux web server (this one powered by Cpanel) , but the chmod (file permissions) of the “public_html” (web root, web docs, htdocs whatever) folder is incorrect on the new server. So, instead of chmodding over 200 files “by hand”, I’ve used the following little script (just run from the command line):

find . -type d -name public_html -exec chmod 0755 {} \;

Basically it searches (using find recursively (ie it checks folders and sub folders/directories and sub directories) for a directory (-type d) called (-name) public_html and when it does it runs the command (-exec) chmod 0755 (which sets the permissions so that the owner can read, write and execute/open the folder and all other users can read and execute/open the folder).

Simple eh? 😉