Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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

share|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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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