Created
July 18, 2011 05:12
-
-
Save EspadaV8/1088594 to your computer and use it in GitHub Desktop.
Simple script to use minecraft over an SSH tunnel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MCLAUNCHER="path/to/MinecraftLauncher.jar" | |
# Your SSH host, e.g. www.example.com | |
SSHHOST="<your-ssh-host>" | |
# Stores the controlmaster file. Need to enable controlpath in the ssh .config file | |
SOCKCTL="~/.mc-ssh-ctl" | |
# Opens up an SSH tunnel to the remote server opening port 8080 locally | |
SSHCMD="ssh -nfN -D 8080 -S ""$SOCKCTL"" ""$SSHHOST""" | |
# Uses the control file to kill the SSH tunnel when finished with minecraft | |
SSHEXIT="ssh -S ""$SOCKCTL"" -O exit ""$SSHHOST""" | |
${SSHCMD} | |
# sleep for 5 seconds to make sure that the connection has been made | |
sleep 5 | |
# Loads up Minecraft with the proxy information using the SSH tunnel | |
java -DsocksProxyHost=127.0.0.1 -DsocksProxyPort=8080 -Xmx800m -jar "$MCLAUNCHER" | |
# when finished, quit SSH | |
${SSHEXIT} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment