In Debian 6, how to start a daemon as a different user?
Services are usually meant to run as root. However, you have 2 options:
You have some sort of script that launches the service as that user. There are a few ways to accomplish this. You could do the following:
sudo -u debian-tor /etc/init.d/service
and then add debian-tor to the sudoer's file for this command
You can use the stop-start-daemon with the --chuid option.
Related videos on Youtube
user
Updated on September 18, 2022Comments
-
user over 1 year
I'm trying to start the Tor daemon as another user. When it installs, Tor automatically creates a new user "debian-tor", however, it does not run as this user, but rather as root.
In Debain 5 I removed Tor from start up with Update-rc.d, and added a new start up script that basically does
su debian-tor -c '/etc/init/tor $1'
. This worked great, but in Dabian 6 (using insserv instead of update-rc.d) it asked for debiant-tor's password (in spite of running as root).I'm at a loss here, my iptables will only work if Tor runs as a different user, and it's much safer not to run it as root. What can I do?
-
Lmwangi almost 13 yearsI can see in my rc.d that the debian daemon starter can accept users `grep -nire start-stop-daemon /etc/init.d/ /etc/init.d/xpilot-ng-server:35: start-stop-daemon --start --quiet --chuid $USER --background `
-
-
Sandburg over 5 yearsHow to make this service start automatically? The presence in
rc0.d/
seems not enough!