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?
sudo bash TeamSpeak3_Start_Install_Update_Script.sh
I don’t know if I answer your question.