An NFS server lets multiple machines access shared files over a network. NFS is commonly used for Linux servers, development environments, backup storage, web clusters, media workloads, internal file sharing, and mixed Windows/Linux infrastructure.
What Is NFS?
NFS stands for Network File System. It allows a client machine to mount a remote directory and use it like a local folder. This is useful when several servers or workstations need access to the same files.
Common NFS Use Cases
- Shared storage between Linux servers.
- Development environments.
- Backup targets.
- Media libraries.
- Web server clusters.
- Mixed Windows and Linux access.
NFS Port
The main NFS port is 2049. Firewalls must allow the required NFS traffic between clients and the server.
Install NFS Server on Linux
sudo apt update
sudo apt install nfs-kernel-server
Create a Shared Directory
sudo mkdir -p /srv/nfs/share
sudo chown nobody:nogroup /srv/nfs/share
Configure Exports
Edit /etc/exports and add a share rule:
/srv/nfs/share 192.168.1.0/24(rw,sync,no_subtree_check)
Apply the Export
sudo exportfs -a
sudo systemctl restart nfs-kernel-server
Mount NFS on a Linux Client
sudo apt install nfs-common
sudo mkdir -p /mnt/share
sudo mount server-ip:/srv/nfs/share /mnt/share
Use NFS on Windows
Windows can access NFS when the NFS client feature is enabled. Install the NFS client feature from Windows Features or PowerShell, then mount the NFS share.
NFS Security Tips
- Restrict access by IP or subnet.
- Use firewall rules.
- Avoid exposing NFS to the public internet.
- Use least privilege permissions.
- Monitor mounted shares and access logs.
Conclusion
An NFS server is a practical way to share files across Linux and mixed infrastructure. Configure exports carefully, restrict access, open only required ports, and test client mounts before using NFS in production.
FAQs
What is an NFS server?
An NFS server shares directories over a network so client machines can mount and access them.
What port does NFS use?
NFS commonly uses port 2049.
Can Windows connect to an NFS server?
Yes, Windows can connect to NFS shares when the NFS client feature is enabled.