Tested on Ubuntu Server 26.04.1 LTS with nfs-kernel-server 2.8.5 and a Windows 11 Pro client (build 26300).
Hi everyone, this time I’m continuing the Ubuntu Server 26.04 series with NFS. If you have a few machines in the same office or home lab, sooner or later you want one folder that all of them can open: scanned invoices, ISO files, backups, a media library. NFS (Network File System) is the classic way to do that on Linux. The server exports a folder, and every client mounts it as if it were a local disk.
There are times when it doesn’t go smoothly though. You add a line to /etc/exports, the client mounts it, and then you can’t write a single file. Or you can write, but every file shows up owned by “nobody” and you have no idea why. Even worse, most guides only show a Linux client, so when someone on Windows asks “can I open this too?”, you’re on your own.
So, you’re ready to share a folder from your Ubuntu server? Read on to get guidance on how to set up an NFS server on Ubuntu 26.04. We’ll cover installing nfs-kernel-server, creating a read write share and a read only share, limiting them to one subnet, testing the mount, and connecting a Windows 11 client PC with the built-in Client for NFS.
Before You Start
You need Ubuntu Server 26.04 with a sudo user. My server is called ubuntu-server with the IP 192.168.207.133, and my Windows client PC is 192.168.207.129 on the same 192.168.207.0/24 network. Replace these with your own addresses. A server that shares folders should keep the same IP forever, so if yours still gets its address from DHCP, I strongly recommend you set a static IP on Ubuntu Server with Netplan first.
A quick word on how NFS decides who you are. It doesn’t ask for a username or password like a Windows share does. The client simply says “I’m UID 1000” and the server believes it, as long as the client’s IP is allowed. That’s why the IP limit and the squash options you’ll see below matter so much.
Check the release, the IP, and the package

lsb_release -d
ip -br a | grep ens
apt-cache policy nfs-kernel-server | head -3The server runs Ubuntu 26.04.1 LTS (1), its LAN address is 192.168.207.133 (2), and nfs-kernel-server isn’t installed yet. The candidate version is 1:2.8.5-1ubuntu1 (3).
How to Install the NFS Server on Ubuntu 26.04
The server side is one package. Here’s what you do.
Install nfs-kernel-server

sudo apt install -y nfs-kernel-serverapt pulls in nfs-common, rpcbind, keyutils and libnfsidmap1 together with nfs-kernel-server (1). The whole download is under 600 kB, so it finishes in seconds.

Near the end of the output you can see the package being set up (1), nfs-server.service being linked to multi-user.target so it starts at boot (2), and an empty /etc/exports being created (3). That file is where all your shares will live.
Check that the server is running

systemctl is-active nfs-server rpcbind
systemctl is-enabled nfs-server
sudo cat /proc/fs/nfsd/versions
ss -tln | grep -E ':(2049|111) 'Both nfs-server and rpcbind are active (1) and nfs-server is enabled (2). The versions line is worth a look: +3 +4 +4.1 +4.2 means NFS version 3 and all the version 4 flavors are turned on (3, port 2049 for NFS itself and 111 for rpcbind). Keep version 3 enabled if you plan to connect Windows, because the Windows client only speaks NFSv2 and NFSv3. If you want to read more about the commands I use to check services, my systemctl command guide covers them.
How to Create the Shared Folders
I’ll make two folders under /srv/nfs. “shared” is a drop box everyone can read and write. “docs” holds files that people should only read, like an SOP or a price list.
Create the folders and set the owner

sudo mkdir -p /srv/nfs/shared /srv/nfs/docs
sudo chown nobody:nogroup /srv/nfs/shared
sudo chmod 775 /srv/nfs/shared
echo 'Office SOP v1' | sudo tee /srv/nfs/docs/readme.txt
ls -ld /srv/nfs/*The shared folder now belongs to nobody:nogroup with 775, while docs stays root:root 755 with one sample file in it (1, 2). Notice that I didn’t use chmod 777, which almost every tutorial does. You don’t need it here, because the export below maps every client to the nobody user, and nobody already owns the folder. If owners and groups are still a bit fuzzy for you, have a look at my chown command explained article.
How to Configure /etc/exports
Each line in /etc/exports is: the folder, who may connect, and the options in brackets. Don’t put a space between the client and the opening bracket. A space there means “these options apply to everyone”, which is a classic way to open a share to the whole world by accident.
Add the two exports and apply them

/srv/nfs/shared 192.168.207.0/24(rw,sync,no_subtree_check,all_squash,anonuid=65534,anongid=65534)
/srv/nfs/docs 192.168.207.0/24(ro,sync,no_subtree_check,root_squash)Add those two lines to /etc/exports (I appended them with tee, nano works just as well), then run:
sudo exportfs -arv
showmount -e localhostexportfs echoes both lines back (1) and prints “exporting” for each folder (2). showmount then lists the two exports, each limited to 192.168.207.0/24 (3). Here’s what the options mean in plain words:
rw or ro decides whether clients may write. sync makes the server write data to disk before it answers, which is slower but won’t lose files if the power goes out. no_subtree_check turns off a check that causes trouble when files are renamed while open; exportfs warns you if you leave it out. root_squash (the default) turns the client’s root user into nobody, so root on a client PC isn’t root on your server. all_squash goes further and turns every client user into the anonymous user, and anonuid/anongid choose which user that is. 65534 is nobody and nogroup on Ubuntu.
Note: Basically, all_squash is perfect for a simple drop box where nobody cares who wrote a file. If you want files to keep their real owners, leave all_squash out and make sure the user IDs match on the server and the clients.
How to Test the Export from the Server
Before walking over to another PC, I like to do a quick test on the server itself. This is only a smoke test, the real client comes next.
Try 127.0.0.1 first

sudo mount -t nfs 127.0.0.1:/srv/nfs/shared /mntMy experience: My first try was the loopback address, and the server refused it with “access denied by server while mounting” (1). That’s actually good news. 127.0.0.1 isn’t inside 192.168.207.0/24, so the IP limit is doing its job. This is exactly the error a PC outside your allowed subnet will get.
Mount through the LAN address instead

sudo mount -t nfs 192.168.207.133:/srv/nfs/shared /mnt
sudo touch /mnt/from-linux.txt
ls -l /mnt
findmnt -no SOURCE,FSTYPE,OPTIONS /mnt
sudo umount /mntThis time the mount works. I created the file with sudo, so as root, and yet it’s owned by nobody nogroup (1). That’s all_squash in action. findmnt shows that a Linux client picks nfs4 with vers=4.2 on its own (2). On another Ubuntu machine you’d install nfs-common and run the same mount command with the server IP.
How to Connect a Windows 11 Client to the NFS Share
Windows 11 Pro ships with an NFS client, it’s just switched off. Here’s how that should go on the Windows client PC.
Open “Turn Windows features on or off”

Press Win+R, type optionalfeatures and press Enter. The “Turn Windows features on or off” window opens (1).
Turn on “Client for NFS”

Scroll down to “Services for NFS” and click the small plus sign to expand it (1). Tick “Client for NFS” (2). You don’t need “Administrative Tools” for this. Then click “OK” (3).

After a few moments you will see “Windows completed the requested changes” (1). Turning it on didn’t ask me for a restart, so I just clicked “Close” (2).
Mount the share as drive Z:

Open Command Prompt (not PowerShell, where “mount” means something else) and run:
mount -o anon 192.168.207.133:/srv/nfs/shared Z:
mountWindows answers “Z: is now successfully connected” (1). Running mount on its own lists the drive as \\192.168.207.133\srv\nfs\shared (2) with UID=-2, GID=-2 (3). The anon option tells Windows to connect as an anonymous user instead of trying to map your Windows account to a Linux UID.
My experience: I used the server:/path form on purpose. The other form, \\192.168.207.133\srv\nfs\shared, works too, but the double backslash at the start is easy to mangle when you paste it from a script or a remote tool. The colon and forward slash version avoids that completely and Windows accepts it the same way.
Write and read a file

echo invoice 2026 > Z:invoice.txt
dir Z:
type Z:invoice.txtThe new invoice.txt sits next to from-linux.txt, the file I created on the server (1), and Windows reads its content back (2). So the share is read write from Windows.
Check who owns the file on the server

ls -ln /srv/nfs/shared
ls -l /srv/nfs/shared
sudo exportfs -vOn the server both files belong to 65534 (1), which is nobody nogroup (2). It doesn’t matter whether the file came from root on Linux or from an anonymous Windows user, all_squash flattens everyone to the same account. exportfs -v also shows the options that are active even though I never typed them, like secure and root_squash. You can see all_squash on the shared folder (3) and ro on docs (4).
Note: Look closely at invoice.txt. It has -rwxr-xr-x, the execute bit included. That’s because the Windows client creates files with fileaccess=755 by default, as the mount list showed. If that bothers you, mount with an option like -o anon,fileaccess=644.
Test the read only share

mount -o anon 192.168.207.133:/srv/nfs/docs Y:
type Y:readme.txt
echo test > Y:new.txtReading readme.txt works fine (1). Writing fails with “The media is write protected” (2). That’s how Windows reports an ro export, so don’t go hunting for a disk problem when you see it.
Check the export list and disconnect

showmount -e 192.168.207.133
umount Z:
umount Y:Client for NFS also brings showmount, which lists the exports straight from Windows (1). That’s a handy first check whenever a mount fails. umount disconnects both drives (2), and a plain mount now shows an empty list.
How to Allow NFS Through UFW
UFW is inactive on my lab server, so I didn’t need a firewall rule. If yours is on, allow only your subnet. For a Linux client on NFSv4, port 2049 is enough. For Windows (NFSv3) the client also needs rpcbind on port 111 and mountd, which uses a random port unless you fix it in /etc/nfs.conf. I didn’t test UFW rules in this lab, so treat this as a starting point and check it with showmount from a client. My guide on how to enable UFW on Ubuntu 26.04 without losing SSH shows how to add rules safely.
sudo ufw allow from 192.168.207.0/24 to any port nfsCommon NFS Problems and Fixes
“access denied by server while mounting” means the client IP doesn’t match the client part of the export line. Check the subnet, and remember that 127.0.0.1 isn’t part of your LAN. Run sudo exportfs -arv after every change, editing the file alone does nothing.
“Permission denied” when writing on an rw share is almost always ownership. With root_squash, root on the client becomes nobody, so the folder must be writable by nobody. ls -ln on the server tells you which UID the files really get.
“The media is write protected” on Windows means the export is ro. Change it to rw on the server if writing is intended.
On Windows, “mount” isn’t recognized or does something strange in PowerShell, because PowerShell has its own mount alias. Use Command Prompt or call mount.exe.
Cleaning Up the Lab
When I was done, I removed the test shares so the server stays clean for the next article. If you want to stop sharing too, here’s how.
Remove the exports and stop the NFS server

sudo sed -i '/^\/srv\/nfs/d' /etc/exports
sudo exportfs -arv
sudo systemctl disable --now nfs-server
sudo rm -rf /srv/nfsexportfs now says “No file systems exported!” (1), nfs-server is inactive (2), and showmount can’t find the service anymore (3). On the Windows side I went back to “Turn Windows features on or off” and unticked “Client for NFS”. Removing it, unlike adding it, asked for a restart.
This concludes how to set up an NFS server on Ubuntu 26.04 and connect a Windows 11 client to it. Next, you would probably want to give each team its own export with its own subnet, or add a Linux client with an /etc/fstab entry so the share comes back after every reboot. If you get an error that isn’t covered here, write it in the comments and I’ll try to help.












