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

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

2 Answers 2

up vote 0 down vote accepted

I believe your question is similar to this one:
http://stackoverflow.com/questions/394984/best-practice-to-run-linux-service-as-a-different-user

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

 
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.