Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Minecraft sever running that gets started automatically using the init.d scripts. Now I want to be able to give myself admin privileges but I need to send commands to the server. How can I do that without stopping it and running it manually?

share|improve this question
so, you want the server running as your user? Just do "sudo -u USER COMMAND" in the init script – nerdy_kid Jun 11 '11 at 19:18
Not exactly. I set up a user called minecraft and that's who the script runs as. But the script is running now and I want to be able to interact with it. How can I send commands to the process while it's running? – CaseyB Jun 11 '11 at 19:25
I'm not sure how the minecraft server works, but if you start it using "screen" then you could connect to it by doing "sudo -u minecraft screen -r" – nerdy_kid Jun 11 '11 at 19:55
I get this message Cannot open your terminal '/dev/pts/0' - please check. Even if I su to minecraft and try to screen -r – CaseyB Jun 12 '11 at 13:55
It's running on a remote server that I ssh into. – CaseyB Jun 12 '11 at 13:58

When you ssh, you need to pass a -t option to allow screen to work. Or you could add your username to the ops.txt file.

But, what you really want is a full-featured bells-and-whistles script that uses screen to interact with the Minecraft server. Check out Minecraft Sheller. I think it provides what you want and more.

share|improve this answer

If you get

Cannot open your terminal '/dev/pts/0' - please check.


sudo -u minecraft
script '/dev/null'
screen -r
share|improve this answer
up vote 0 down vote accepted

I ended up just calling sudo /etc/init.d/minecraft stop then starting the server java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui and opping my player and starting it again with sudo /etc/init.d/minecraft start

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.