09 Sep, 2012, Koumintang wrote in the 1st comment:
Votes: 0
Ok I think i have this in the right forum. I am running my own server for my game, I have it setup to automatically start the game when the server starts. The problem i am having is when the game saves one of the files, a pfile, or area file, it changes the name of the owner from the original name, to root. Is there a way for it to stop doing this? Also, it changes all the permissions for those said files when they save under root. This is causing issues within the game.
10 Sep, 2012, Davion wrote in the 2nd comment:
Votes: 0
Is it done via an init.d script? could just add an su call in it. instead of

"sudo -u kour /home/kour/mud/src/executable"

Maybe a little more on how you setup these startup scripts :).
10 Sep, 2012, plamzi wrote in the 3rd comment:
Votes: 0
Probably the easiest thing to do is to not run the server script as root.

Log in as a user of your choice, then crontab -e, then add your script @reboot. Voil. All your files should now have normal user permissions, and you can add other users to this user's group to allow them access.

And since you've already run the script as root, you'll need to do 'sudo chown -R username.username .' inside the server directory to make sure all files are owned by that user.
11 Sep, 2012, quixadhal wrote in the 4th comment:
Votes: 0
If you happen to be using debian, there's a utility used in their init scripts that might be helpful. In fact, using one of their init scripts as a template is probably a good idea.

In any case, start-stop-daemon takes an argument of –user as well as –chuid user:group

For example, my own mud uses:
case "$1" in
echo -n "Starting MUD Server: WileyMUD"
if start-stop-daemon –quiet –stop –signal 0 –pidfile $PIDFILE –name wileymud –user wiley
echo " already running."
/sbin/start-stop-daemon –start –quiet –chuid wiley:users –chdir $STARTDIR –background –pidfile $PIDFILE –exec $SCRIPT – -P $PIDFILE -L $LOGFILE $PORT
echo "."

Not perfect, but it usually gets the job done. Of course, you'd want to fill in all the variables with your own stuff, and the arguments after the double dash are specific to my game driver. YMMV.