[SOLVED] Launch Minecraft and Minecraft server as non-root user
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Launch Minecraft and Minecraft server as non-root user
Hello everyone, I have a few questions about running Minecraft and Minecraft server as root and non-root user.
First of all in a few words let me tell about how I launch them now. I have an official Mojang account and downloaded Minecraft.jar and Minecraft_server.1.8.9.jar from an official site minecraft.net. I want Minecraft be at /usr/local/games/ and Minecraft server at /usr/local/games/minecraft_server/ so I moved them to wished path. I cannot access /usr/local/ path as non-root user (for example if run mkdir /usr/local/testdir the output will be "Permission denied") so I thought it is necessary to use sudo before commands java -jar /usr/local/games/minecraft.jar or java -jar /usr/local/games/minecraft_server/minecraft_server.1.8.9.jar when I want to launch the game or server. For the first time I launched them via sudo. But then I found that I can run minecraft.jar without sudo and it will work! But I can't run server without sudo because if I do that the server wouldn't be able to find and then to create file server.properties (I think because it hasn't permission to write at /usr/local/.../ path as non-root process) so it wouldn't work.
My questions are:
1. Is it possible to run Minecraft server at /usr/local/games/minecraft_server/ as non-root process maybe in any other way? It is obvious that if possible it is better to run any process as non-root.
2. If it isn't possible is it safe to run Minecraft server as root? I had to run it as root for about week ot two and there wasn't any troubles with it and my system in general but on the other web-sites I found quotes like "NEVER EVER RUN MINECRAFT SERVER AS ROOT!" or "NEVER! ever! run minecraft as root."
3. If, for example, it is possible is it safe for existing world on my server? Or will server launched without sudo overwrite existing files and create a new world? I don't want this because I play on server with my friends.
4. After installation Minecraft created /.minecraft and /.oracle_jre_usage directories at my user and root home directories. Is it safe just to remove /root/.minecraft and /root /.oracle_jre_usage? I understood that there are all saved games that I have played in singleplayer when used to launch Minecraft via sudo but can it cause any other problems? Will the game works after that just without saved worlds in singleplayer?
If it is important my distribution is GNU/Linux Slackware 14.1 and desktop environment is KDE 4.10.5.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.