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.

Create a free website or blog at