The Network File System Utilities
In Ubuntu Linux, the nfs-common and nfs-utils packages provide the necessary background services (like nfs-client.target, rpc.statd, and rpc.idmapd) required to mount and interact with Network File System (NFS) shares. NFS is a protocol widely used in enterprise environments and home labs to allow multiple Linux servers to read and write to the same central storage array as if it were a local hard drive.
While this is essential if your server relies on a NAS (Network Attached Storage) device, it is completely unnecessary if your machine relies entirely on its own internal hard drives or modern cloud block storage (like AWS EBS). If you are not mounting external NFS drives, having these RPC (Remote Procedure Call) daemons running in the background wastes a small amount of memory. Furthermore, because these services are designed to listen for network file locking and ID mapping requests, leaving them running on a public-facing server unnecessarily expands your potential attack surface. You should disable these utilities if you do not use NFS.
How to Disable NFS Services
The cleanest way to disable these services is to stop the primary target that invokes them.
Warning: Do not do this if your server boots from a network drive or uses a NAS for data storage, as you will lose access to your files.
- Open your Ubuntu Terminal or connect via SSH.
- If you are absolutely certain you will never need to mount an NFS share on this machine, the best option is to simply purge the package:
sudo apt-get purge nfs-common
- If you cannot remove the package due to dependencies (or you want to keep the binaries installed just in case), you can stop the active services:
sudo systemctl stop nfs-client.target
sudo systemctl stop rpc-statd.service
- Disable them from starting on boot:
sudo systemctl disable nfs-client.target
sudo systemctl disable rpc-statd.service
- To ensure no other process can invoke them, mask them:
sudo systemctl mask nfs-client.target
sudo systemctl mask rpc-statd.service
Your Ubuntu server will no longer load the background daemons required for Network File System connections.