You can start any process as another user with su
or sudo
, no need for both.
sudo -H -u otheruser bash -c 'echo "I am $USER, with uid $UID"'
So, to start TeamSpeak as the teamspeak
user, use
sudo -H -u teamspeak <path_to_TeamSPeak>/TeamSpeak
See Run a shell script as another user that has no password for more details.
To "autorun" this at start up, there are many ways to do this. You could use an rc script:
- Place the line above into a text file called
autostart_teamspeak.sh
, and save it in /usr/local/bin
, for example. You could run chmod +x autostart_teamspeak.sh
as well, to make it executable.
- Edit
/etc/rc.local
to add the line sh +x /usr/local/bin/autostart_teamspeak.sh
which will call the script, upon start up.
For other ways for achieving the same, see Execute script on start-up.