0

I need to run a script with "sudo" right and at some point in the script I have to run a program with "(su $TS3_USER -c "$TS3_DIR/ts3server_startscript.sh start")" to avoid this "WARNING! For security reasons we advise: DO NOT RUN THE SERVER AS ROOT" but the user I created "(adduser --system --group --disabled-login --disabled-password --no-create-home "$TS3_USER")" just before did not have login rights this is done by security so I encounter the following error when "This account is currently not available."

test start script with "sudo" :

#!/bin/bash
TS3_USER="teamspeak3"
TS3_DIR="/opt/teamspeak3-server_linux_amd64"

## Check if user exists
if getent passwd $TS3_USER > /dev/null 2>&1; then
    #echo "User alrealy exist"
    echo ""
else
    ## add the user to run ts3server
    echo "No, the user does not exist"
    if adduser --system --group --disabled-login --disabled-password --no-create-home "$TS3_USER" >/dev/null 2>&1; then
      echo -e "\nAdded new user: '$TS3_USER'"
    else
      echo -e "\n ERROR!!! Failed to add new user: '$TS3_USER'\n"
      exit 1
    fi
fi

Install() {
$TS3_DIR/ts3server_minimal_runscript.sh createinifile=1
}

result : "WARNING! For security reasons we advise: DO NOT RUN THE SERVER AS ROOT"

If i test with this even does not work :

Install() {
su $TS3_USER -c "$TS3_DIR/ts3server_startscript.sh stop"
}

result : "This account is currently not available."

How can I solve this problem?

3
  • If you substitute your account for the teamspeak3 user, does it work? Aug 30, 2020 at 19:24
  • Hello @ajgringo619 sorry, I don’t understand your question Currently the current user I use in ssh connection is vincent1890 from it I run sudo bash TeamSpeak3_Start_Install_Update_Script.sh I don’t know if I answer your question. Aug 30, 2020 at 19:44
  • I meant to substitute a normal login user (like yourself) for the account you created. I want to see if it's choking on not being able to login or access it's home directory. Aug 30, 2020 at 19:46

0

You must log in to answer this question.

Browse other questions tagged .