im running a 7Days to Die server. Usually i connect via ssh with user "linux" and run the command:
/home/linux/start
This works, server is running.
But when i switch user to root (su root) and run:
sudo -u linux /home/linux/start
or
sudo -u linux -i bash -c '/home/linux/start'
the server is shutting down after 5 min and i get this in the logfile:
Failed to create secure directory (/run/user/0/pulse): Permission denied
Failed to create secure directory (/run/user/0/pulse): Permission denied
Failed to create secure directory (/run/user/0/pulse): Permission denied
and after some lines i also get:
2015-06-23T12:12:15 17,008 INF Disconnect
2015-06-23T12:12:15 17,008 INF NET: Stopping server protocols
Platform assembly: /home/linux/7daysded/7DaysToDie_Data/Managed/Mono.Security.dll (this message is harmless)
2015-06-23T12:12:15 17,054 INF NET: Untiy NW server stopped
2015-06-23T12:12:15 17,055 INF [Steamworks.NET] NET: Server stopped
2015-06-23T12:12:15 17,055 INF [NET] ServerShutdown
Same goes for xinetd. When the xinetd server trys to run the script, it crashes too.
I guess when i run it via sudo or xinetd, the User ID is still 0 (root) instead of 1000 (linux). How can i solve the problem?
The Startscript:
#!/bin/bash
if pgrep "7DaysToDie." > /dev/null
then
exit
else
cd /home/linux
screen -A -m -d -S 7DaysServer /home/linux/7daysded/startserver.sh -configfile=serverconfig.xml
screen -ls
fi
Some info about my System:
Debian Version 8.1
Linux version 3.16.0-4-amd64 (debian-kernel@lists.debian.org) (gcc version 4.8.4 (Debian 4.8.4-1) ) #1 SMP Debian 3.16.7-ckt11-1 (2015-05-24)
Thanks and Regards,
Patrick
UPDATE:
i tried to run as root:
ssh -t linux@localhost -p 1111 "/home/linux/restart"
I hoped it would be the same as doing it over ssh with putty. But it still doesnt work.