Skip to content

Network File System (NFS)

On a server

Bash
sudo apt install nfs-kernel-server
Bash
sudo mkdir /net-disk

Careful with ownerships.

Bash
sudo chown nobody:nogroup /net-disk
Bash
sudo chmod 777 /net-disk

Edit

Bash
sudo nano /etc/exports
Text Only
/net-disk       IP or hostname(rw,sync,no_subtree_check) IP-2(rw,sync,no_subtree_check)
  • or add subnet
Text Only
/somedisk   {subnetIP}/{subnetMask}(rw,sync,no_subtree_check)
  • Give permission to client to change permissions (no_root_squash):
Text Only
/somedisk   *(rw,insecure,sync,no_subtree_check,no_root_squash)

After adding hostnames or IP you need to run:

Bash
sudo exportfs -a

On client

Bash
sudo apt install nfs-common
Bash
sudo mkdir /net-disk-client
Bash
sudo mount -t nfs IP:/net-disk /net-disk-client
Bash
sudo nano /etc/fstab
Bash
{IP of NFS server}:{folder path on server} /net-disk-client nfs defaults 0 0
Bash
mount /net-disk-client
Bash
mount {IP of NFS server}:{folder path on server}