What is a correct minecraft server setup on Linux?

Hi, I’m back :slight_smile:
A big thank for the help you gave me !
It’s been a while because I was busy but recently I reinstalled one of my server machines and so I’ve started applying your advice to improve my installation. I haven’t tested expect yet, for now I’m training to use screen and to setup an application correctly. I’m trying to setup a custom discord bot CatDeeJay.jar. It’s a jar so it will be similar when I will have to setup minecraft servers.

I created a system group discord. I created a system user catdeejay, member of previous group.
I made a directory /discord/minecraft owned by catdeejay:discord and with correct permissions on all sub files using umask 022 as you told me. In this directory I have CatDeeJay.jar and start which is as you guessed my start script with u+x permission. This start script creates a screen session and launches the jvm.

Now here is what happens in my head:

  1. I would like to always run my bot using the catdeejay user as you told me, but most of the time I’m connected to ssh using my admin user. For now I’m using sudo -u catdeejay ./start to start my bot. The created screen session is configured to be multiuser so my admin user can then reattach using screen -r catdeejay/mybot without having to change user. I discovered yesterday the existence of the setuid and setgid bits. Maybe enabling these on my start script can be a solution to avoid sudo.

  2. I would like to allow my admin account to write in /discord/catdeejay because I connect to sftp using my admin account and I can’t use sudo in sftp (Filezilla). My plan is to add g+w permission recursively in /discord/catdeejay and then add my admin account to the discord group.

As always, I’m wondering if it is the correct way to do things. That’s why I’m asking for help here if someone have some time for me.

Of course, I’ve could just have created catdeejay as a normal (non-system) user and then connect with this user on ssh or sftp. The problem will come when I will have dozens of different servers/applications and therefore dozens of users to manage. I would like to manage everything from one user if possible.