This question has been asked previously in https://joomla.stackexchange.com/questions/20697/securing-a-joomla-installation-on-apache-mod-php but it may belong here better since it is not Joomla specific.
I'm trying to execute a script in tcsh, and receive different results from running the commands individually on the command line to executing the script. The attempt is to secure all directories below public_html; and assign more open permissions to some directories afterwards (e.g. cache, logs etc).
find ./public_html -type f ! -user apache -exec chmod 644 {} \;
find ./public_html -type d ! -user apache -exec chmod 755 {} \;
chmod -R 777 public_html/cache/
chmod -R 777 public_html/administrator/cache/
chmod -R 777 public_html/logs/
chmod -R 777 public_html/tmp/
In the above, quite often I find all permissions restricted but e.g. the cache, log or tmp directories unwritable after running the script. If I execute all commands one after another on the command line it works as expected. It'd be great if you might have an idea what I should be looking at instead?
Thanks for any suggestion.