0

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"?

2 Answers 2

0

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

I'd suggest checking several of the mentioned options

0

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

1
  • 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, 2009 at 11:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .