Easy SSH Tunneling
Whenever I work out of the San Francisco office, I have to tunnel back to my workstation in Palo Alto in order to do any development. The way I do this is with an SSH Tunnel. While I used to just fire it up manually, the other day I hacked up some shell scripts to automatically connect and start up my most used apps on the remote machine, and I thought I’d share them here.
First, on the local machine:
/usr/local/bin/tunnel:
#!/bin/sh
$IPADDR=0.0.0.0 # IP Address of the remote machine
$LOGON=usrname # Your username on the remote machine
$STARTUP=/usr/local/bin/startup
ssh -X $IPADDR -l $LOGON $STARTUP
and, on the remote machine:
/usr/local/bin/startup:
#!/bin/sh
gnome-terminal &
nautilus &
firefox &
pidgin &
xchat &
Essentially, a list of programs to start up. Don’t forget the & on each line, or else they won’t all start at the same time.
Make sure that both files are executable (chmod +x), then you can add a launcher to /usr/local/bin/tunnel and you’re good to go.
It’s a pretty simple trick, but it saves me several seconds each time I connect to the network. Also, as there’s no terminal needed to keep the ssh session open, I don’t accidentally lose my session.

