I'm working on a small controlpanel for a hobby project of mine, which is supposed to set up game servers. But I have some concerns regarding security that I would like some input on.
My first idea is to have the controlpanel "remote" (which a web frontend interacts with) running as an user, and when setting up game servers they would all go in a subdirectory of it's home folder, like so:
/home/paneluser/servers/server1/ /home/paneluser/servers/server2/ /home/paneluser/servers/server3/
But then, as users would have FTP access to these subdirectories, they would be able to upload malicious code (i.e. change the executable) so they could easily gain access to files of other servers and for example delete files.
My second idea is to run the controlpanel "remote" as it's own user (root?) which then creates separate users for each server and starts them as the appropriate user.
My third idea is to expand on the first one, and run all servers in some kind of sandbox where where the executables can't access files outside. But I do not technically know how this would be done or if it's even possible.
So what I would like to know is what the best approach would be. Or is there another, better, approach?