You are not logged in.
hello
how would i find in my web docs (/home/user/htdocs) all directories named "templates_c" so i can do a chmod on them.
they need to be writable by the app, but i think 775 is not enough, i think they might need tto be 777 or atleast o+w i believe. its for smarty template engine to write the template files on initial compilation.
i have been trying various wildcard version of find and chmod, but i dont want to foul things up.
Last edited by wolfdogg (2012-01-07 02:50:14)
Offline
Make a copy of this directory and try things out.
Post the find command you've come up with.
Offline
i was already able to alter the permissions with chmod o+x templates_c
but theres several of those directories spread across my web files since i have numerous apps, some of which use smarty,
i was trying
find .*templates_c -type d -print|xargs chmod 777
but that seems syntactically incorrect i dont know the best way to use wildcard for this
Last edited by wolfdogg (2012-01-07 03:32:16)
Offline
Test run, to see what matches (just prints out the matches):
sudo find /home/user/htdocs -type d -name "template_c" -print
Chmod matches:
sudo find /home/user/htdocs -type d -name "template_c" -exec chmod 755 {} \;
If this is for $smarty->compile_dir, I'd rather chown the directories to user "http" (or "www-data" or what ever user your web server runs as) than chmod 777, especially if the directories are accessible via the net.
Edit: Same with $smarty->cache_dir, it needs to be writable for the user web server runs as.
Last edited by samuvuo (2012-01-07 03:39:59)
Offline
i ran as root, it didnt find anything. there is atleast 3 of those directories in there. i had to manually set them again. there is probably more. Is there something i can change on that last command that might be keeping it from finding anything?
its just a local testing server, i had the permissions chowned to "http", but the problem comes when everytime i upload a new file across ftp when logged in as user, it goes back to user, so i ended up chowning everything to user instead.
Offline
i ran as root, it didnt find anything. there is atleast 3 of those directories in there. i had to manually set them again. there is probably more. Is there something i can change on that last command that might be keeping it from finding anything?
its just a local testing server, i had the permissions chowned to "http", but the problem comes when everytime i upload a new file across ftp when logged in as user, it goes back to user, so i ended up chowning everything to user instead.
Could you please confirm whether you tried the commands Samuvuo suggested? Please specify whether the following command found the required directories:
sudo find /home/user/htdocs -type d -name "template_c"
Although, I would personally run the command like so, cos I'm noob:
find ~/htdocs -type d -regex ".*/template_c.*"
Offline
i can confirm that the command Samuvuo suggested didn't return any results. but i just realized, its templates_c, not template_c. YES, now im getting some results. there is 5 of them listed, it works both as root, and as sudo from the users account.
Thanks guys.
So whats the best way to switch it out now to make the changes?
Offline
well, now that i have figured out that the find works, my initial question i still need help on if somebody can possibly give me a hand on it. whats the best command to change out the permissions on a find?
Offline
is that a webserver , i would not do 777 on it. you need to give it permissions for the user running your web service .
Offline
were going in circles here. :-) i think samuovuo provided the answer, and i didnt try the2nd command he issued with the correct directory name.
Disregard the actual 777, i will work on that later. i have to figure out the best permission scheme. (its not a production server, and no internet access)
find /home/user/htdocs -type d -name "*templates_c" -exec chmod 777 {} \;
looks right doesnt it?
in actuality, i think 775 might work, and the group would be http, this way apache can write to it.
Last edited by wolfdogg (2012-01-20 21:08:55)
Offline