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.


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.


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

  • So there is no reason why it couldn't/shouldn't set group, for what ever reason it just doesn't? – Jacks_Gulch 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

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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