LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   Running a service as a user (https://www.linuxquestions.org/questions/linux-security-4/running-a-service-as-a-user-334687/)

Jake_da_Snake 06-17-2005 04:04 PM

Running a service as a user
 
Similar thread has been posted before but no solid answer.
I'm running a teamspeak server on my gentoo box. Teamspeak comes with a script that can start and stop and restart the server similar to scripts in init.d.
There are two problems with this script.
1. the script must be run from it's directory. If you run it as a link or move it from it's original directory it wont run. This is the minor problem however. I'm not very familiar with scripts but I'm sure there is a way to get around it.

2. The second problem is for security reasons this programs should not be run as a root. So how would you place it in init,d and start it as a different user than root? The SUDO way looks like the hard way to go. I mean apache and ftp and all the other servers dont run as root and they are all on startup.
So what's the easiest way to run services as a user on start up?
Thanks in advance.

Noth 06-17-2005 04:22 PM

Apache and most FTP servers have an option in their config files to be told what user to run as, they are then startes as root by init and then change their uid after they finish any priviledged operations.

Sudo is probably your best bet, Debian has a tool called start-stop-daemon that lets you specify uid, gid, chroot, etc but I don't know if Gentoo has anything similar.


All times are GMT -5. The time now is 03:31 AM.