Gavin’s Odd Bits of Code

2012-12-14 (Fri)

Permanent SSH tunnel to OS-X behind NAT

Filed under: Uncategorized — Gavin Brock @ 5:23 pm
Tags: , , ,

I sometimes have an OS-X machine behind NAT that I want to get back to when I’m on the internet.

One way to achieve this is to set up an ssh tunnel on a machine with a known IP.

I put this file in “/Library/LaunchDaemons/com.example.ssh-tunnel.plist”:


<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE plist PUBLIC “-//Apple Computer//DTD PLIST 1.0//EN””&gt;
<plist version=”1.0″>









In this example, is the globally known server, and remote_user is set up with ssh keys to allow passwordless access.

Now if I ssh to and then ssh to localhost:9922, I get back to the NATed machine.

2010-05-02 (Sun)

csshX 0.72

Filed under: Software,Uncategorized — Gavin Brock @ 8:59 pm

Another production release, like all future releases, this is a 10.5 or newer version.

Bug Fixes:

  • Dragging the bounds window between spaces now works (this is implemented in some embedded Ruby since there was no simple way to do it in Perl).
  • Fixed crash when opening windows to hosts that failed.
  • Reworked the coloring of windows in select/enable/disable mode. Those rare cases when the color was not reset should be fixed.


  • Much faster at opening windows. Some nasty AppleEvents code has helped grab control of the opened window faster.
  • –space command line option (and equivalent config command) to open csshX windows in a particular space.

I now have no bugs, and no user feature requests, so I’m getting bored. ;-)

Feedback welcome..

2010-03-30 (Tue)

csshx 0.64 released

Filed under: Uncategorized — Gavin Brock @ 10:57 pm

I have finally cut a new csshX package – a lot of good stuff in this one:

New Features

  • Host and Subnet Ranges – see below
  • Ping test hosts before attempting to connect
  • Sort terminals by hostname
  • Zoom a single terminal to ‘full screen’ key binding
  • Added “enable next terminal” key binding
  • Added “send slaveid” (a guaranteed unique ID) to a terminal
  • Check for users odd shell settings in

Bug Fixes

  • Added the work-around for 10.6 64bit
  • Better window placement (less overlaps)
  • Use the system stty, not macports
  • Better handling of terminal color changes
  • Lots of doc typos and spelling fixes (and probably some new ones)

Get it here:


Hostname ranges

If you have a lot of similarly named hosts, or which to open all hosts in a subnet, hostname ranges will simplify things. Howerver this also allows to open crazy numbers of windows. To avoid this you can use the “ping_test” to make sure a host is up and ssh is working before opening a terminal window.
You can specify subnets using two syntaxes:
This will also work with a hostname, assuming it resolves to a valid IP. If the IP address is not the network address, only that IP and IPs above that address will be used (e.g. will only use 2 ip addresses).
A range is declared in square brackets. Rules are separated by commas. Ranges use a minus-sign. Ranges can be numeric or alphabetic.
Some examples:

csshX now on Twitter!

Follow brockgr on Twitter

2009-04-30 (Thu)

csshX 0.61 released

Filed under: Uncategorized — Gavin Brock @ 11:41 am

New features:

  • A new “[s]end” mode that allows you to send host-names/connection strings to all windows
  • ssh-options can now be configured or set on the command line.
  • p in bounds mode shows you your current bounds, good for pasting into csshrc
  • Ctrl-a Ctrl-m to minimise all windows including master
  • Ctrl-a Ctrl-h to hide all windows and minimise master (my favourite :-))

Bug fixes:

  • Infinite loop on “enable mode” when some windows have closed.
  • Some document corrections

Available at:


Blog at