GooseOps

How to Set Up a Local NFS Share for Windows, macOS & Linux

Published on December 22, 2025


🎯 Quick‑Start: A Local NFS Share That Everyone Can Use

In this post we’ll walk through a “technical” path for creating a network‑shared folder that all of your devices can see.

Why NFS?
Fast, stateless, and natively supported on Unix‑like systems.
We’ll keep the setup minimal, but you can expand it with ACLs, encryption, or move to SMB/CIFS later – we’ll touch on that too.


📋 Prerequisites

ItemHow to Check
Root (or sudo) access on the serversudo -v
Internet connectivity for package installsping -c 3 google.com
Firewall open on ports 2049, 111, 20048 (optional, see below)sudo ufw status
NFS client enabled on Windows (see “Windows client” section)

Tip – If you’re using a pre‑built appliance (e.g., Synology, QNAP), they usually come with an NFS server baked in, but the commands below are for a clean‑slate Linux box.


🖥️ Server Setup – Debian/Ubuntu

  1. Update & install NFS kernel server

    sudo apt update
    sudo apt install -y nfs-kernel-server
    
  2. Create the export directory & set permissions

    sudo mkdir -p /srv/nfs/share
    sudo chown -R nobody:nogroup /srv/nfs/share      # NFS anon user
    sudo chmod 777 /srv/nfs/share                    # open to everyone (change later)
    
  3. Configure exports

    Open /etc/exports and add:

    /srv/nfs/share  *(rw,sync,no_subtree_check,no_root_squash)
    
    • rw – read/write
    • sync – write synchronously
    • no_subtree_check – ignore subtree changes
    • no_root_squash – allow root access (use with caution)

    Security Note – If you want stricter access, replace * with specific IP ranges and use root_squash + fsid= for NFSv4.

  4. Export the shares

    sudo exportfs -ra
    
  5. Restart the service & enable at boot

    sudo systemctl restart nfs-kernel-server
    sudo systemctl enable nfs-kernel-server
    
  6. (Optional) Open firewall

    sudo ufw allow from any to any port 2049 proto tcp
    sudo ufw allow from any to any port 111   proto tcp   # rpcbind
    sudo ufw allow from any to any port 20048 proto tcp   # NFSv4 portmapper
    sudo ufw reload
    

🧑‍💻 Client Setup

1️⃣ macOS

# Create mount point
sudo mkdir -p /Volumes/share

# Mount
sudo mount -t nfs -o nolock <SERVER_IP>:/srv/nfs/share /Volumes/share

Add to /etc/fstab for auto‑mount at boot:

<SERVER_IP>:/srv/nfs/share  /Volumes/share  nfs  nolock,_netdev,auto  0  0

Tip – Use autofs for dynamic mounts if you want to unmount when idle.

2️⃣ Linux (any distro)

# Install client packages
sudo apt install -y nfs-common

# Create mount point
sudo mkdir -p /mnt/share

# Mount
sudo mount -t nfs -o nolock <SERVER_IP>:/srv/nfs/share /mnt/share

Add to /etc/fstab:

<SERVER_IP>:/srv/nfs/share  /mnt/share  nfs  nolock,_netdev,auto  0  0

3️⃣ Windows 10/11

Windows natively supports SMB, but you can also mount NFS shares:

  1. Enable NFS Client
    Open Control Panel → Programs → Turn Windows features on or off → Check “Services for NFS” → OK.

  2. Map network drive (cmd)

    net use X: \\<SERVER_IP>\srv\nfs\share
    

    If you see “The network name cannot be found”, double‑check that the server’s firewall allows port 2049.

  3. Mount via PowerShell (recommended for modern syntax)

    New-Item -Path "X:" -ItemType Directory
    New-Item -Path "X:" -ItemType Directory
    New-Item -Path "X:" -ItemType Directory
    

    Troubleshooting – Windows NFS client is a bit quirky with NFSv4. If you run into “Access is denied”, try disabling root_squash on the server side or using anon export instead.


🔐 Optional: Harden the Share

FeatureHow to enable
NFSv4 only/etc/nfs.conf → fsid = 0 and no no_root_squash
Export ACLssetfacl -m g:staff:rwx /srv/nfs/share
Firewall only for your LANsudo ufw allow from 192.168.1.0/24 to any port 2049
Kerberos authenticationInstall krb5-config + configure /etc/krb5.conf (advanced)

🚨 Troubleshooting Checklist

SymptomCheckCommand
Clients cannot see the shareServer listening?`sudo ss -tulpn
Mount fails with “Permission denied”Export options?cat /etc/exports
No traffic on port 2049Firewall?sudo ufw status
Clients see “no such file or directory”Path mismatch?ls -l /srv/nfs/share
NFSv4 clients get “nfs: server denied mount request”root_squash or ACLs?exportfs -v

📚 What’s Next?


🎉 Wrap‑Up

You’ve now got a fully functional NFS share that:

Happy hacking, and stay tuned for the Easy‑Button version of this tutorial coming next!


Feel free to fork the markdown template, tweak the commands for your distro, and drop comments or pull requests. Happy building!

Contact Us