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 CentOS based server only to server web pages and nothing else. How do I disable NFS services under RHEL / CentOS / Fedora Linux?


You can easily disable NFS, which is a commonly used for sharing data and files between machines. However, its use opens many potential security holes. If NFS is not needed, improve the security by removing and disabling NFS. Open a command-line terminal (select Applications > Accessories > Terminal), and then type:
# chkconfig nfslock off
# chkconfig rpcgssd off
# chkconfig rpcidmapd off
# chkconfig portmap off
# chkconfig nfs off

Delete nfs-utils and portmap packages using the yum command:
# yum remove portmap nfs-utils

See also:

This entry is 11 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 SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot 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 VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

7 comments… add one
  • Thamizhannal P Aug 16, 2009 @ 13:53

    I am using NFS in cluster infrastructure(RHCE4) . Do you have any other alternative for NFS ?

  • Big Dog Aug 17, 2009 @ 10:19

    You can use sshfs…

    Edited by moderator: Fixed link

  • pravinkumar chavan Feb 16, 2011 @ 10:22

    i am linux debian v 5.0 user having busybox 1.16.1 and want to remove nfs totally .
    i am butting from windows hyperterminal/putty.
    above commands not working for me.
    getting error
    #chkconfig nfslock off
    /bin/sh: chkconfig: not found

    how to remove nfs related setting?

    • 🐧 nixCraft Feb 16, 2011 @ 11:55

      You need to run:

      /etc/init.d/portmap stop
      /etc/init.d/nfs-kernel-server stop
      apt-get --purge remove nfs-kernel-server nfs-common portmap

      See this tutorial for more info.

      • pravinkumar chavan Feb 17, 2011 @ 7:27

        Thanks Vivek, for replying.
        Actually there is no portmap file or directory under init.d
        what i have is
        # cd /etc/init.d/
        # ls
        alsa-utils udev module-init-tools udev-mtab

        the one who designed the system told me that he allready hv disable the nfs settings. But then i m not getting the reason for problem.

        also I dont have /etc/fstab file

  • Dre Sr Apr 26, 2011 @ 20:40

    I’m runnin Windows Server 2003 with NFS service going and i need to kill the NFS service complete but security scans show it still being there how to kill it completely?

  • Amina Feb 10, 2012 @ 8:09

    my hp 4050n ntwroek printer doesn’t work with large images and certain pdf files in linux.. windows 7 it works flawlessly. I was impressed with Ubuntu’s printing , but it isn’t up to windows spec. It’s also a lot slower with my ntwroek printer.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.