Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Background:

I'm a Ubuntu/Debian fan and most of my development experience has been on that platform but my current employer uses Redhat. I needed to write a simple init.d script and want the resulting program to run as an unprivileged user. Most resources I found suggest using the daemon function in lieu of start-stop-daemon.

Question:

Why doesn't the daemon function have an option to set the group like the start-stop-daemon? I'm sure there must be a reason for this, just not sure what that reason is.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

You can certainly change the daemon function to set the group or you can write your own mydaemon function to do it.

Or in a simplest possible way just call the runuser command that daemon() uses to start your program with particular UID and GID

share|improve this answer
    
So there is no reason why it couldn't/shouldn't set group, for what ever reason it just doesn't? –  Jacks_Depression Sep 15 '12 at 16:23
    
@Jacks_Depression By default it should set the default group for the user as well. But if it doesn't you can change it. –  Karlson Sep 15 '12 at 16:47

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.