Managing a server over SSH

6,895

Solution 1

Use screen. You'll find it in the package manager.

So start a screen session, then start the minecraft server.

Next time you ssh to the box, you can screen -r and it will bring the session back.

Solution 2

If the server is a command line program, consider running it in a screen session.

e.g.:

$ screen
$ minecraft-server-program

Then press Ctrl-A-D to detach from the session. From an ssh session, type in screen -r to resume the screen session.

Share:
6,895

Related videos on Youtube

Grady S
Author by

Grady S

Updated on September 18, 2022

Comments

  • Grady S
    Grady S over 1 year

    I am running a Minecraft server on Fedora 15. I have openssh-server installed on the server and I can connect to it just fine.

    Right now, the Minecraft server software opens into a terminal when the user logs in. The server software has a console that accepts commands and prints status updates and stuff like that. I am wondering if there is a way that I can access that already-running server console remotely over SSH.

    • Paul
      Paul over 12 years
      Heh. Looks like everyone loves screen. I think Dolda2000 was first.
  • Grady S
    Grady S over 12 years
    Is there any way that I can detach a screen session running locally on the machine while I am using ssh?
  • Paul
    Paul over 12 years
    If you have a prompt, you can type screen -d. If you are running something, you can type ctrl-a-d. Also, just ending your ssh session will leave the screen session running in a detached state. If you use linux command line more than a little, you really want to get into using screen. It will make you happy. Look online for .screenrc examples. screen can run multple concurrent bash shells that you can switch between, which saves running multiple ssh sessions - and they all survive a logout-login.
  • Paul
    Paul over 12 years
    While this isn't really a place for chatting - do you know the pros and cons versus screen? Ctrl-b is one already, but I could always remap ctrl-a in screen if it bothered me enough.
  • Jin
    Jin over 12 years
    @Paul Why does it bother you? I've actually remapped tmux's prefix key from b to a. Anyway, you can check out this Unix.SE question for the comparison. unix.stackexchange.com/questions/549/tmux-vs-gnu-screen
  • Paul
    Paul over 12 years
    Some of the console apps I use from time to time need ctrl-a - but not frequently enough to make it worthwhile, I just work around it normally.