Debian / Ubuntu Linux Disable / Remove All NFS Services

NFS was not designed with security in mind, and has a number of weaknesses, both in terms of the protocol itself and because any NFS installation must expose several daemons, running on both servers and clients, to network attack. I use my Debian / Ubuntu Linux based server only to server web pages and nothing else. How do I disable NFS services under Debian or Ubuntu Linux?

Following packages are used to provide NFS client and server services under Debian / Ubuntu Linux:

  1. nfs-kernel-server – NFS server package.
  2. nfs-common – NFS support files common to client and server
  3. portmap – RPC port mapper.

Stop NFS Services

Open a command-line terminal (select Applications > Accessories > Terminal), and then type the following command top stop NFS client and server services as follows:
$ sudo service portmap stop
$ sudo service nfs-kernel-server stop
$ sudo /etc/init.d/portmap stop
$ sudo /etc/init.d/nfs-kernel-server stop

Delete Services

Delete nfs-kernel-server, nfs-common, and portmap packages using the apt-get command as follows:
$ sudo apt-get --purge remove nfs-kernel-server nfs-common portmap

See also:

This entry is 7 of 15 in the Linux / UNIX NFS File Server Tutorial series. Keep reading the rest of the series:
  1. CentOS / Redhat: Setup NFS v4.0 File Server
  2. Debian / Ubuntu Linux: Setup NFSv4 File Server
  3. Mac Os X: Mount NFS Share / Set an NFS Client
  4. RHEL: How Do I Start and Stop NFS Service?
  5. How To Restart Linux NFS Server Properly When Network Become Unavailable
  6. Linux Iptables Allow NFS Clients to Access the NFS Server
  7. Debian / Ubuntu Linux Disable / Remove All NFS Services
  8. Linux: Tune NFS Performance
  9. Mount NFS file system over a slow and busy network
  10. Linux Track NFS Directory / Disk I/O Stats
  11. Linux Disable / Remove All NFS Services
  12. Linux: NFS4 mount Error reason given by server: No such file or directory
  13. Linux NFS Mount: wrong fs type, bad option, bad superblock on fs2:/data3 Error And Solution
  14. CentOS / RHEL CacheFS: Speed Up Network File System (NFS) File Access
  15. Increase NFS Client Mount Point Security

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 3 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
3 comments… add one
  • al biheiri Mar 8, 2011 @ 19:30

    ? nfs4 was designed with security in mind.

  • shabbir Sep 6, 2011 @ 14:12

    ok ok ubuntu

  • vga over cat5 Nov 25, 2011 @ 12:21

    I have remove portmap service on my vps server. When I look at the network port status by “netstat -tunl ” it was showing port 794 and after remove portmap daemon the port number go away. Not my ethernet traffic so clean, I wondered if removeing the daemon will help memory a bit. Because I recognized when I was started my vps cleanly my vps’s memory was show 220.000 KB, after remove process 150.000KB. Just curies if anyone have a such experiences.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum