Skip to content

Instantly share code, notes, and snippets.

@wstam88
Forked from proudlygeek/nfs-tunnel.md
Created May 30, 2016 13:39
Show Gist options
  • Save wstam88/004d46729ae1331ac9c78cd8d8e9b85b to your computer and use it in GitHub Desktop.
Save wstam88/004d46729ae1331ac9c78cd8d8e9b85b to your computer and use it in GitHub Desktop.
Mount NFS Folder via SSH Tunnel

1. Install NFS on Server

Install the required packages (Ubuntu 12.04):

apt-get install nfs-kernel-server portmap

2. Share NFS Folder

Open the exports file:

vim /etc/exports

Add the following line:

/home/proudlygeek  localhost(insecure,rw,sync,no_subtree_check)

Restart NFS Service:

service nfs-kernel-server restart

or just export the FS:

exportfs -a

3. Install NFS Client

Install the client:

apt-get install nfs-common portmap

Make a mount folder:

mkdir /mnt/nfs-share

Setup an SSH tunnel (local-to-remote port):

ssh -fNv -L 3049:localhost:2049 user@hostname

Mount the folder:

mount -t nfs -o port=3049 localhost:/home/proudlygeek /mnt/nfs-share
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment