PDA

View Full Version : Forking to non-root system account on Linux server


LeeRyman
07-06-2004, 11:21
Gday all,

I would like to suggest that the next incarnation of the TeamSpeak server changes UID to a non-root system account when it forks from the initial account. At the moment I'm using something like the following to change users manually from within rc.local (alternitivly, you could mess with setuid)...

# su \
-–command=”/usr/tss2_rc2/teamspeak2_server_startscript start” \
--shell=”/bin/sh” \
tss

... where tss is my non-root system account with minimal privleges, no shell, no home, etc. (Don't mind the linebreaks, just there for clarity with the long arguments)

The outcome of such a feature is that you could symlink the startup script into your rc.d init script runlevel dirs and have it automaticly change to a safer user without any extra work when installing the server. Correct me if Im wrong but you could probably setuid the teamspeak executable or its startup script instead and get the same result.

Other than that, keep up the excellent work fellas. Im really quite impressed at the professionalism of the server and client, and am very pleased you created a Linux version of the client as well.

Regards,

Lee

LeeRyman
11-06-2004, 17:43
Hi again.

As the very knowledgeble ET|pwklinuxfan pointed out to me in #Teamspeak, This kind of behavior might make it overly complicated, as non-root users would not have the neccessary permisions to create a new "tss" user.

A simpler solution he offered was to have something along the lines of including...

if [ "$UID" = "0" ]; then
su tss -c "$0 $@"
...
...at the start of the init script, which should work nicely. Thanks pwk!