lets make a tunnel!

I’m sitting on an unsecure wireless network and I’d like to send my
traffic back to the office so I whipped out…. a little bash (what’d you expect? sidenote: whilst
attending a ruby conference! burn)… I started out using per-service
ssh tunnels and that proved to be a bit of a pain, especially when the
connection is very inconsistent. Someone suggested simulating a
socks5 proxy (thanks, matt) and that’s simple enough….

#!/bin/bash -v
kill -9 $(ps ax | grep ssh./*\-D | cut -d’ ‘ -f2)
ssh -D 8080 -f -C -q -N erik@box

I’m killing off the existing connection, should I loose state (note -
code this one out for multiple instances in case I start more than one
instance) with the kill. That line basically reads:
kill with signal nine the pid resulting from cutting out column two of
grepping for ssh -D from ps. The second line is setting up a
compressed ssh tunnel back to the computer named box with the login
erik on a dynamic port 8080, background the ssh process, keep quiet,
and don’t execute a remote command. Loquacious explanation for
something fairly trivial.

go *nix!

  1. 2 Trackback(s)

  2. Dec 26, 2011: Buy Facebook Fans
  3. Jan 24, 2012: nice website design

You must be logged in to post a comment.