I have a local Debian box and a remote FreeBSD box.  I can edit files on the
remote box over SSH, but it would be much nicer if I could edit them
locally.  Until today, I never realized how easy it is to do just that.

My first thought was to try and tunnel NFS, but NFS is complicated, so that
sounds messy.  My next idea was Samba.  I like Samba because it is easy to
use and the server side runs entirely in user space.  This means I could
mount just about any box's remote file system.  I'm Feeling Lucky for "samba
over ssh" gave me this:

http://www.ibiblio.org/gferg/ldp/Samba-with-SSH/

Wow, mounting a share over Samba merely requires a single TCP port.  I
always setup Samba with the "homes" share enabled read-write, so I can mount
my home directory from Windows.  That makes this really easy.  First create
the SSH tunnel:

ssh -qfN -L 2050:localhost:139 bob at mybox.example.com

Then mount it:

mkdir mybox
smbmount //localhost/bob mybox -o username=bob,port=2050

This can be wrapped up into simple shell script:

#!/bin/sh

USER=bob
HOST=mybox.example.com
DIR=mybox
PORT=2050

[ -d $DIR ] || mkdir $DIR
[ $(ls -1 $DIR | wc -l) -eq 0 ] || exit
ssh -qfN -L $PORT:localhost:139 $USER@$HOST
smbmount //localhost/$USER $DIR -o username=$USER,port=$PORT

-- 
David Phillips <david at acz.org>
http://david.acz.org/


_______________________________________________
TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
http://www.mn-linux.org tclug-list at mn-linux.org
https://mailman.real-time.com/mailman/listinfo/tclug-list