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?
Oooh, recursive algorithms. We had a lecture about that last week
.
I did not know how to use the -exec parameter and i tried chmod +x `find -type d` to make all subdirectories accessible.
But that did not work with long filenames (with spaces and such).
Your solution does it well!
Thanks a lot!
That was just what I was searching for. I didn’t want chmod -R to change the directory priviliges as well. Thanks.
U can do it with smartftp – right click folder and with chmod option.
Just click box with ” apply on subdirs and files”