2

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?

5
  • so, you want the server running as your user? Just do "sudo -u USER COMMAND" in the init script
    – nerdy_kid
    Jun 11, 2011 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, 2011 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, 2011 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, 2011 at 13:55
  • It's running on a remote server that I ssh into.
    – CaseyB
    Jun 12, 2011 at 13:58

3 Answers 3

2

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.

2

If you get

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

use

sudo -u minecraft
script '/dev/null'
screen -r
0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .