2

Here is my setup:

  • Office computer in a network, with no way to access from outside, (OC)
  • embedded computer in the field (FC)
  • Server in the office, containing data to which the field computer needs access. Office computer mounts a directory from this server, it is NFS

I regularly work on the field computer over SSH, the problem is to access the data on the office server from the field computer.

So far I have solved this by mounting the field computer in my office computer with sshfs. It works ok but it has drawbacks. I would like to get and push info directly from my SSH session, not from another local session on my local office computer (for example, running git from the sshfs mountpoint is very slow).

I understand that this could be achieved by an SSH reverse tunnel.

Here is what I have tried, logging in from office computer (OC) to field computer (FC):

gauthier@OC $ ssh -R 9001:<nfs_server_name>:2049 FC

(FC is setup in my ~/.ssh/config)

As far as I understand, this opens port 9001 on FC, to listen to OC's idea of <nfs_server_name> on port 2049.

9001 could be anything that is not reserved, 2049 is the port for NFS.

I can ping <nfs_server_name> from OC.

After SSH to FC, I try to mount the port as NFS:

gauthier@FC $ mkdir mp_test
gauthier@FC $ sudo mount -t nfs localhost:9001 mp_test/

This just hangs, then times out.

I thought I might need to give a path in the NFS server, so I also tried:

gauthier@FC $ sudo mount -t nfs localhost:9001:/path/to/directory/I/usually/mount mp_test/

Obviously I am doing something wrong, either with ports or with mount.

What has been working is to make FC's port 9001 to listen to OC's <nfs_server_name> on port 80. Then I could open localhost:9001 on FC and see the NFS server's web interface. This makes me think I'm quite close.

How do I mount the office NFS server directory on the field computer?


After some more search, I tried this:

gauthier@OC $ ssh -R 5100:<server>:2049 -R 5200:<server>:2233 FC
gauthier@FC $ sudo mount -v -t nfs -o port=5100,mountport=5200 localhost:/path/to/share/dir mp_test
[sudo] password for gauthier: 
mount.nfs: timeout set for Thu Apr 30 14:14:27 2015
mount.nfs: trying text-based options 'port=5100,mountport=5200,vers=4,addr=127.0.0.1,clientaddr=127.0.0.1'
mount.nfs: mount(2): Protocol not supported
mount.nfs: trying text-based options 'port=5100,mountport=5200,addr=127.0.0.1'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: portmap query retrying: RPC: Program not registered
mount.nfs: prog 100003, trying vers=3, prot=17
mount.nfs: portmap query failed: RPC: Program not registered
mount.nfs: requested NFS version or transport protocol is not supported

And with tcp (at this point you can see I am trying black magic formulas without understanding what I am doing :/):

gauthier@FC $ sudo mount -v -t nfs -o tcp,port=5100,mountport=5200 localhost:/path/to/share/dir mp_test/
mount.nfs: timeout set for Thu Apr 30 14:15:04 2015
mount.nfs: trying text-based options 'tcp,port=5100,mountport=5200,vers=4,addr=127.0.0.1,clientaddr=127.0.0.1'
mount.nfs: mount(2): Protocol not supported
mount.nfs: trying text-based options 'tcp,port=5100,mountport=5200,addr=127.0.0.1'
connect_to <server> port 2233: failed.
connect_to <server> port 2233: failed.
connect_to <server> port 2233: failed.
4
  • 1
    If sshfs is slow, NFS is going to be no better, even if you can get it working through the tunnel.
    – EEAA
    Commented Apr 30, 2015 at 12:30
  • I think sshfs is slow with git because I run OC's git from a repo that is on sshfs. My hope is that running git from FC's local repo would be faster, since it is designed to work that way with push and pull (push and get changes from remote to local, not the opposite as working from within sshfs is)
    – Gauthier
    Commented Apr 30, 2015 at 12:43
  • But I'd be ok with mounting the server on FC with sshfs, I guess. As in, ssh to FC, setup a sshfs back from FC to server. In that case, the sshfs directory would be git's remote, not git's local, which is what I want. I've tried that, to no av ("read: Connection reset by peer").
    – Gauthier
    Commented Apr 30, 2015 at 12:45
  • It's not only the speed, it's also more practical to git push and pull from the ssh session.
    – Gauthier
    Commented Apr 30, 2015 at 12:49

0

You must log in to answer this question.

Browse other questions tagged .