Results 1 to 5 of 5

Thread: Start-up script help. Run as different user.

  1. #1
    Join Date
    Dec 2007
    Beans
    13

    Start-up script help. Run as different user.

    I am trying to get teamspeak to run as a user named teamspeak that I created.

    Right now, it starts but it is running as root, which I definately do not want it to do.

    Here what the entry in the start up script looks like:

    rm -rf /servers/teamspeak/tsserver2.pid
    su -u teamspeak
    "/servers/teamspeak/server_linux" &

    I am not sure if this is the correct syntax.
    It was copied from a friend that uses slackware.

    Any help would be appricated.
    Thanks in advance.

  2. #2
    Join Date
    Oct 2007
    Location
    Spessart
    Beans
    18
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Wink Re: Start-up script help. Run as different user.

    Your script doesn't work the way you want. Let's have a look:

    Code:
    su -u teamspeak
    This command opens a subshell with the teamspeak user.

    Code:
    "/servers/teamspeak/server_linux" &
    But this line doesn't run in your subshell - it runs in the default root environment. That's the problem.

    You should add the -c command instead.

    Code:
    rm -rf /servers/teamspeak/tsserver2.pid
    su -l teamspeak -c "/servers/teamspeak/server_linux" &
    That should help your teamspeak work

    Update: Yes, the syntax was wrong.
    Last edited by Paindistributor; August 26th, 2008 at 08:30 PM. Reason: fixed wrong syntax

  3. #3
    Join Date
    Dec 2007
    Beans
    13

    Re: Start-up script help. Run as different user.

    When I use that command, I get "su: must be run in a terminal"

  4. #4
    Join Date
    Mar 2008
    Location
    California, USA
    Beans
    8,111

    Re: Start-up script help. Run as different user.

    I think you are using the syntax incorrectly with su. Take a look at this thread, as I think it will answer your question:
    http://ubuntuforums.org/showthread.php?p=5662769

  5. #5
    Join Date
    Dec 2007
    Beans
    13

    Re: Start-up script help. Run as different user.

    Thanks for the help.
    Although, after searching, I found a guide for this specific issue.
    It mainly came down to folder/file ownership.

    After that was cleared, I was able to make a script to start it and stop it via start-stop-daemon. It then was simply an issue of having it run a start command as the user at boot.

    Again, thanks for the help guys.
    I am sure that the su command syntax thing will be useful in the future, when I get more running on here.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •