Installing NFS Server / NFS Client on Debian

NFS (Network File System) is a network file system that allows users to access files and directories located on remote computers. Faster compared to SAMBA and less resource intensive compared to encrypted remote file systems – sshfs, SFTP …

Installing an NFS server

Updating the package list

$ sudo apt update

Installing an NFS server

$ sudo apt install nfs-kernel-server

Create a directory, which we will share in the future, and set access rights

$ sudo mkdir /mnt/storage
$ sudo chmod 777 /mnt/storage/

Allow network access to the directory for a specific client

$ sudo nano /etc/exports
/mnt/storage      192.168.10.8(rw,sync,no_root_squash,no_subtree_check)

Applying the network access settings

$ sudo exportfs -r

Checking

$ sudo systemctl status rpcbind nfs-server

$ sudo exportfs
/mnt/storage    192.168.10.8

Installing the NFS client

Updating the package list

$ sudo apt update

Installing the NFS client

$ sudo apt install nfs-common

We start the services

$ sudo systemctl start rpcbind
$ sudo systemctl enable rpcbind

Create a mount point

$ sudo mkdir /mnt/localstr
$ sudo chown user:user /mnt/localstr

Mount the NFS directory

$ sudo mount -t nfs4 192.168.10.12:/mnt/storage /mnt/localstr

Where:

  • 192.168.10.12:/mnt/storage – NFS server address
  • / mnt / localstr – local mount point

Setting up automatic mounting

$ sudo nano /etc/fstab
[...]
192.168.10.12:/mnt/storage    /mnt/localstp    nfs    defaults    0 0
Sidebar