In this tutorial we show how to use OSX to mount a samba server that is behind a firewall.
The topology of the network is as depicted below:

Tutorial
In order to connect to the samba server we first need to setup an ssh tunnel to it. To do that, follow the tutorial on setting up an ssh tunnel that can be found here.
Once you have followed that tutorial you can easily add the samba drive in the following way.
1. Open a new finder window and go to the “Go” dropdown menu in Finder:
2. In the “Go” dropdown menu select “Connect to Server…”
3. Add the samba server:
Here we have added the directory directory_on_samba
accessible by the user username
. The connection is made to the localhost
on port 22139. We do this because we have established the ssh tunnelling. Therefore we are, in fact, connecting to the port 139 of the samba server with IP 131.180.123.190.