I am setting up a few PHP Gearman Daemons running on PEAR System_Daemon. I need them to be able to write to the following locations...

/var/run/{APPNAME}.pid
/etc/init.d/{APPNAME}
/gearman/log/{APPNAME}.log

What permissions should I set for them? I don't mind creating a different user or what have you, but I am just not the greatest with File Permissions. I want to do this right, not chmod 777 for ease of use and running as root which is never a good idea.

Help this file permission idiot?

link|improve this question

feedback

1 Answer

up vote 0 down vote accepted

create a user:group for this daemon, and give them the permissions you need. as root you can always sudo -u newuser $program

link|improve this answer
What exact chmod should I give them? Obviously init.d will need the most, but I don't want to do a blanket chmod 777... – Urda Feb 8 '10 at 13:36
I'd say 550 should be ok. and of course chown $user:$group script.sh – dyasny Feb 8 '10 at 14:26
chmod 550 = Read + Execute for Group and Owner Right? ...wouldn't the log file need to a write flag? – Urda Feb 8 '10 at 14:35
1  
yes, if you're writing, you'll need to have rw access, 660 I guess – dyasny Feb 8 '10 at 14:57
Yes, the System_Daemon method writes an init.d script on first or updated startup, updates log file always, and needs to write the PID file. I'll try this later today / tomorrow and let you know if System_Daemon likes the new settings. Much better than blanket permissions :) – Urda Feb 8 '10 at 15:03
show 2 more comments
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.