Actions

SSH

From CreeperHost Wiki

DISCLAIMER - SSH is a very powerful tool that will enable you to wreak chaos and devastation across your VPS. Because of the ease with which a user can make mistakes and wipe entire drives using SSH, we do not provide support for using SSH and can not help you if you make a mistake and break something. That being said - here's a very basic guide to using SSH to start your Minecraft server. Use it at your own risk!

What is SSH?

SSH is a secure network protocol for remote command-line login. If you've never used it before, it can be a bit daunting; you'll be doing everything by typing commands into a command line; instead of clicking a folder to open it, you'll type a command to open that folder - and so on.


Connecting via SSH

Our preferred method of using SSH is via PuTTY - http://www.putty.org . Once downloaded and opened, you'll see something like this;

o1B90.png

Your remote access details for connecting to your server via SSH are in your Control Panel, via Virtual/Dedicated Server > SFTP/SSH Access. Don't use 'root' as the username - use 'minecraft' (doing things in root can cause problems). Enter your host name or IP into the topmost box, and then click Open. Type in your username when prompted, and then your password (you can copy your password with CTRL+C, and paste it into the password prompt with a right-click. You won't see any text there, but right-clicking WILL paste it, and then just hit enter. You'll then log in. If you get a pop-up box about a certificate when first connecting, make sure to click YES to trust the connection.

Launching a Server

You'll need to launch your server with a startup script - like a .bat file for Windows, if you're familiar with those, but on Linux it's a shell script, saved as .sh and I've provided an example down below. To create an .sh file, just open a new text file and save it with the .sh file extension - something like 'start.sh'. To launch your .sh script, you'll first need to navigate to the folder that contains the script. Typing ls (tha'ts a lower-case L) into putty shows you everything in your current location. The script should go into wherever your craftbukkit.jar is located - normally /home/minecraft on CreeperHost servers.. To navigate to that directory via SSH, type cd (for 'change directory') and then the path; so if it's in /home/minecraft, you'd type: cd /home/minecraft . Once there, type ls just to confirm you see your script there.

Your script will need to be given 'execute' permissions before you'll be able to run it; type: chmod +x scriptname.sh (where scriptname is the name of your script) and press Enter.

To run the script, type: ./scriptname.sh (where 'scriptname' is replaced with the file name of your script).

Screen Sessions

You'll need to start your server in a 'screen' - otherwise, you won't be able to close PuTTY, as closing it will kill the server. A 'screen' is, simply, an area where your server will run even after you've closed PuTTY. If your .sh script doesn't include a command that tells the server to start in a screen, you'll have to put that in there.

This is a basic command for starting Minecraft in a screen;

screen -dmS minecraft java -Xms1024M -Xmx1024M -jar minecraft_server.jar nogui


FTB Server Launch Parameters

If you've got custom parameters that you want to apply to your FTB server, you can put those into your .sh file too. The FTB parameters can overwrite the "-Xms1024M -Xmx1024M" section. The first bit, 'screen -dmS minecraft', tells it to start a screen called minecraft . The next bit is the java parameters. Change "minecraft_server.jar" to craftbukkit.jar as per the name of your jar.

When you've got all of your parameters inside your .sh file, just run it again with ./scriptname.sh .


Managing Your Server

To look inside your screen session and get to the server console;

  • screen -li will show you a list of screens; you'll see one called minecraft, with a number to the left.
  • screen -r xxxx (where xxxx is the number of the minecraft screen) will take you into that screen; this will be your Minecraft server console where you can watch server log, type commands, etc. You can also just use: screen -r minecraft
  • To detach from a screen and keep it running, CTRL+A and then D .
  • To stop the server, type stop into the console and that will stop the server. This should also exit the screen when Minecraft closes.


Help, I'm Confused :(

SSH can seem very daunting to new users. The best thing we can recommend is to play with it, and there are of course loads of tutorials on the internet for starting Minecraft via SSH and with a script, and in a screen.