Skip to content

Instantly share code, notes, and snippets.

@tekacs
Created April 20, 2011 17:55
Show Gist options
  • Save tekacs/932137 to your computer and use it in GitHub Desktop.
Save tekacs/932137 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"
}
@tekacs
Copy link
Author

tekacs commented May 14, 2011

Hi - a few pointers, which I should have put in at the time but I hadn't quite got around to...

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"

@ali
Copy link

ali commented May 14, 2011

Thanks for the response. Admittedly, I'm quite new to dealing with bash files and servers. Here's what I've got now:

function show() {
  SERVERUSER="root"
  VPS="66.228.41.55"
  DOMAIN=".*****-**.members.linode.com"
  REMOTE="$2$DOMAIN"
  ssh -l $SERVERUSER -tR 1080:127.0.0.1:$1 $VPS  "sudo ssh -Nl \$SERVERUSER -L $REMOTE:80:127.0.0.1:1080 localhost"
}

Returns: Could not resolve hostname sn.*****-**.members.linode.com:80:127.0.0.1:1080: Name or service not known. I don't know if this is a problem with the script or if it's a problem with the way I set up my Linode.

@tekacs
Copy link
Author

tekacs commented May 14, 2011 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment