You are not logged in.

#1 2012-01-07 02:48:56

wolfdogg
Member
From: Portland, OR, USA
Registered: 2011-05-21
Posts: 545

how would i find for permissions for certain directory

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)


Node.js, PHP Software Architect and Engineer (Full-Stack/DevOps)
GitHub  | LinkedIn

Offline

#2 2012-01-07 03:01:19

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: how would i find for permissions for certain directory

Make a copy of this directory and try things out.
Post the find command you've come up with.

Offline

#3 2012-01-07 03:31:55

wolfdogg
Member
From: Portland, OR, USA
Registered: 2011-05-21
Posts: 545

Re: how would i find for permissions for certain directory

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)


Node.js, PHP Software Architect and Engineer (Full-Stack/DevOps)
GitHub  | LinkedIn

Offline

#4 2012-01-07 03:38:17

samuvuo
Member
From: Finland
Registered: 2011-02-20
Posts: 84

Re: how would i find for permissions for certain directory

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

#5 2012-01-14 04:57:43

wolfdogg
Member
From: Portland, OR, USA
Registered: 2011-05-21
Posts: 545

Re: how would i find for permissions for certain directory

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.


Node.js, PHP Software Architect and Engineer (Full-Stack/DevOps)
GitHub  | LinkedIn

Offline

#6 2012-01-14 05:18:54

/dev/zero
Member
From: Melbourne, Australia
Registered: 2011-10-20
Posts: 1,247

Re: how would i find for permissions for certain directory

wolfdogg wrote:

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

#7 2012-01-15 12:37:55

wolfdogg
Member
From: Portland, OR, USA
Registered: 2011-05-21
Posts: 545

Re: how would i find for permissions for certain directory

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?


Node.js, PHP Software Architect and Engineer (Full-Stack/DevOps)
GitHub  | LinkedIn

Offline

#8 2012-01-17 12:07:26

wolfdogg
Member
From: Portland, OR, USA
Registered: 2011-05-21
Posts: 545

Re: how would i find for permissions for certain directory

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?


Node.js, PHP Software Architect and Engineer (Full-Stack/DevOps)
GitHub  | LinkedIn

Offline

#9 2012-01-17 12:55:37

RaisedFist
Member
From: Romania
Registered: 2007-01-30
Posts: 556
Website

Re: how would i find for permissions for certain directory

find /path/to/search -type d -name -exec chmod 777 {} ;\

Of course, you'd want to change the find conditions and the mode in "chmod".

Offline

#10 2012-01-17 13:03:28

Zulfikar
Member
Registered: 2011-12-18
Posts: 57

Re: how would i find for permissions for certain directory

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

#11 2012-01-19 04:25:36

wolfdogg
Member
From: Portland, OR, USA
Registered: 2011-05-21
Posts: 545

Re: how would i find for permissions for certain directory

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)


Node.js, PHP Software Architect and Engineer (Full-Stack/DevOps)
GitHub  | LinkedIn

Offline

Board footer

Powered by FluxBB