Skip to content

Instantly share code, notes, and snippets.

@bradparks
Forked from tekacs/show
Created July 17, 2012 11:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradparks/3128949 to your computer and use it in GitHub Desktop.
Save bradparks/3128949 to your computer and use it in GitHub Desktop.
This does something essentially equivalent to showoff.io if you have a publicly facing server...
# Usage: show <local-port> <subdomain>
function show() {
DOMAIN=".tekacs.com"
REMOTE="$2$DOMAIN"
ssh -tR 1080:127.0.0.1:$1 vps "sudo ssh -Nl \$USER -L $REMOTE:80:127.0.0.1:1080 localhost"
}
##########################################################################################################
more details on how this works from original gist:
The easiest option is to put the following in your ~/.ssh/config file:
Host vps
HostName <server address>
User <server username>
If you don't want to (or can't) do this, then the following will work:
SERVERUSER="<server username>"
ssh -l $SERVERUSER -tR 1080:127.0.0.1:$1 <server address> "sudo ssh -Nl \$SERVERUSER -L $REMOTE:80:127.0.0.1:1080 localhost"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment