NFS Share mount over SSH Tunnel

From wiki.linuxonlinehelp.de
Jump to: navigation, search

used OS-Debian

On Server:

  • sshd installed
  • nfs-kernel-server package installed
  • rpcbind installed

at /etc/exports set:

/usbdrive           localhost(rw,async,no_root_squash,no_subtree_check,crossmnt,insecure)
  • insecure allow usage over localhost!

On Client:

  • ssh client installed
  • nfs-common Metapackage installed

Open 2 Terminals / Consoles, DO NOT send to BACKGROUND! cause that you can disconnect by STRG+C fast! Enter now

on Terminal 1:

ssh -L 3049:localhost:2049 USER@SERVERIP

on Terminal 2

sudo mount -t nfs localhost:/usbdrive /mnt -o port=3049,proto=tcp,soft,nosharecache

Port is internal redirected from 2049 (nfsd) to 3049 at localhost! nosharecache is helping against freezes, soft helps against freezes at lookups of slow Networks

Advantage? No public external NFS Shares, all transfer is ENCRYPTED! May somtimes slow but very secure!