NFS

Linux Server

$ sudo apt install nfs-kernel-server

$ cat /etc/exports
/data/ghost  *(rw,sync,no_subtree_check,insecure)

$ sudo mkdir -p /data/ghost

$ id pi
uid=1000(pi) gid=1000(pi)

$ sudo chown pi:pi /data/ghost

$ touch /data/ghost/README.txt

$ sudo systemctl restart nfs-server

$ rpcinfo -u localhost nfs 3 # for NFSv3 via UDP
program 100003 version 3 ready and waiting

$ rpcinfo -t localhost nfs 4 # for NFSv4 via TCP
program 100003 version 4 ready and waiting

$ showmount -e localhost
Export list for localhost:
/data/ghost *

$ hostname -I
192.168.255.144

Linux Client

$ sudo apt install -y nfs-common

$ cat /etc/fstab | grep nfs
192.168.255.144:/data/ghost /home/pi/ghost nfs4 rw,relatime,noauto,user 0 0

$ pwd
/home/pi

$ mkdir -p ghost

$ mount ghost

$ umount ghost

As systemd unit: https://wiki.archlinux.org/title/NFS

# /etc/systemd/system/mnt-ghost.mount
[Unit]
Description=Network File System

[Mount]
What=192.168.255.144:/data/ghost
Where=/mnt/ghost
Type=nfs4

[Install]
WantedBy=multi-user.target
# /etc/systemd/system/mnt-ghost.automount
[Unit]
Description=Automount NFS

[Automount]
Where=/mnt/ghost

[Install]
WantedBy=multi-user.target

Windows Client

C:\> type nfs.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default]
"AnonymousGid"=dword:000003e8
"AnonymousUid"=dword:000003e8

C:\> nfs.reg

C:\> nfsadmin client stop

C:\> nfsadmin client start

C:\> mount -o anon \\192.168.255.144\data\ghost Z:

C:\> mount

Local    Remote                                 Properties
-------------------------------------------------------------------------------
Z:       \\192.168.255.144\data\ghost           UID=1000, GID=1000
                                                rsize=1048576, wsize=1048576
                                                mount=soft, timeout=0.8
                                                retry=1, locking=yes
                                                fileaccess=755, lang=ANSI
                                                casesensitive=no
                                                sec=sys

C:\> umount Z:
Network File System overview
Explains what Network File System is.
nfsadmin
Reference article for the nfsadmin command, which manages both Server for NFS and Client for NFS.

Windows only supports NFSv2, NFSv3.

For NFSv4 only server: https://peteris.rocks/blog/nfs4-single-port/

# /etc/default/nfs-kernel-server
...skip...
RPCMOUNTDOPTS="--no-nfs-version 2 --no-nfs-version 3 --nfs-version 4 --no-udp"
RPCNFSDOPTS="--no-nfs-version 2 --no-nfs-version 3 --nfs-version 4 --no-udp"