What are the full steps one needs to do to mount a directory from a Linux machine as a network drive on a Windows machine via NFS?
Incomplete answer:
Linux side:
- Install the NFS server and utilities (
nfs-utilsor your distribution's equivalent). - Create the directory
/srv/nfs. - Create a new empty directory under
/srv/nfs, e.g.files. - Bind-mount the created directory to the directory containing you want to share, e.g.:
sudo mount --bind /home/user/stuff/files /srv/nfs/files Create or edit
/etc/exports, and add the line:/srv/nfs 192.168.0.0/16(rw,all_squash,no_subtree_check,anonuid=65534,anongid=65534)(the above assumes the Windows machine is on the same LAN as the Linux machine, with the subnet having a 192.168.0.0/16 prefix - adjust as needed).
Start the NFS server (e.g.
sudo systemctl start nfs-server.service).
- Install the NFS server and utilities (
Windows side:
In Control Panel, open Programs and Features, there find Add/remove Windows components, and enable Services for NFS and everything under it.
Open a command prompt, and type:
mount -o anon \\192.168.0.1\srv\nfs\files Z:(assuming your Linux machine is at 192.168.0.1).
The directory should now be available on the Z: drive. (Type
start Z:at the command prompt to open it in Explorer).
The above instructions seem to be incomplete - I just get a permissions error when attempting to access the mounted drive. Adding the options insecure and anonuid/anongid had no effect.