1

TeamSpeak may not have root privileges. That's why I have a user created with

adduser teamspeak

I want to start TeamSpeak with the teamspeak user.

How I can add an "autostart" for my VServer (Ubuntu14.04) that is started by this user? Because, when I reboot the server, then it should also restart TeamSpeak.

2

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.