Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a daemon that I want to launch on startup using the standard service framework (e.g. a file in /etc/init.d/rc.d, launched using /sbin/service). I've written scripts for the service framework before, so I don't need basic knowledge there.

However, I've never tried to run a process that shouldn't be launched as root. The process itself doesn't support chrooting on startup, and I don't want to run it as root. Short of using su or sudo in the launch script, is there any preferred or recommended way to say "run this script on startup as user X"?

share|improve this question
up vote 0 down vote accepted

I believe your question is similar to this one:

I'd suggest checking several of the mentioned options

share|improve this answer

Perhaps setuid is what you are looking for? If the daemon is running as root you can create a new accoun with limited permissions (just enough perms to run the daemon) and setuid to that account in the daemon

share|improve this answer
The problem is that setuid is the right answer if I control the source code for the process, but I don't. I'm looking for something I can do in the service script itself rather than inside the actual daemon process. – Kirk Wylie Nov 6 '09 at 11:16

Your Answer


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.