-
-
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...
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
# 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" | |
} |
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"
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.
Ok, a few things - firstly, if you insist on logging in directly as root to the server (a strategy I wouldn't suggest, in favour of making a new user account on the server with the same name as your local account and just using the original script - search Google for instructions on how to add users with "useradd") then the command can be quite vastly simplified to:
ssh -l root -R $REMOTE:80:127.0.0.1:$1 $VPS
(again, I _really_ recommend adding a new user and following the original method instead of using this simplified command, for security reasons...)
Also, I should point that you probably want a public-facing domain to use (which is what you put in $DOMAIN) (set up with Linode DNS Manager) rather than your Linode member subdomain - if you're going to go with that, DynDns will probably serve you rather better...
I'm afraid I'm going to be disappearing after this e-mail, I should point out, so any further comments will have to be from others and also, most of the things that I suggest above are more far reaching than changes to the script. As such, if you'd like any more help with this my very best suggestion would be to consider http://serverfault.com/, which has a very, very helpful community who might be able to lead you through all of these steps...
## I hope this helps!
Amar Sood
…On Saturday, 14 May 2011 at 19:11, aliukani wrote:
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=".li322-55.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.
##
Reply to this email directly or view it on GitHub:
https://gist.github.com/932137
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I really want to use this, but I'm getting this error:
ssh: Could not resolve hostname vps: nodename nor servname provided, or not known
Also, how can I modify this if my username on my vps is different from my username on my laptop?