Skip to content

Instantly share code, notes, and snippets.

@LamberKeep
Created June 28, 2024 20:35
Show Gist options
  • Save LamberKeep/8788cd93bb044f919ca4148b47f3c5d8 to your computer and use it in GitHub Desktop.
Save LamberKeep/8788cd93bb044f919ca4148b47f3c5d8 to your computer and use it in GitHub Desktop.
Minecraft RCON connection via SSH.
# RCON is BAD, don't open this port! There no security for your server!
# Instead of this, use SSH:
# 1. Install on the server mcrcon by Tiiffi (https://github.com/Tiiffi/mcrcon).
# 2. Set environment variables as $MCRCON_HOST, $MCRCON_PORT and $MCRCON_PASS.
# 3. Use next script...
ssh $MCRCON_HOST mcrcon -H localhost -P $MCRCON_PORT -p $MCRCON_PASS $@
# You also can create command alias in .bashrc:
alias ssh2rcon='ssh $MCRCON_HOST mcrcon -H localhost -P $MCRCON_PORT -p $MCRCON_PASS'
# This script has been tested and works as intended.
# Example:
# $ sh ssh2rcon.sh help
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment