Fedora 25 and disabling whatever is listening on port 111

fedoranetworkingsystemd

I've got a Fedora 25 x86_64 stand alone workstation. Something is listening on port 111 (identified with an nmap scan):

$ sudo lsof -i :111
COMMAND PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
systemd   1 root   36u  IPv4  15170      0t0  TCP *:sunrpc (LISTEN)
systemd   1 root   37u  IPv4  15171      0t0  UDP *:sunrpc
systemd   1 root   38u  IPv6  15172      0t0  TCP *:sunrpc (LISTEN)
systemd   1 root   39u  IPv6  15173      0t0  UDP *:sunrpc

I disabled the Sun gear on the port with the following commands:

$ sudo systemctl disable rpcbind
$ sudo systemctl disable sunrpc
Failed to disable unit: No such file or directory

After reboot the port is still open.

It appears something other than Sun gear wants to listen on port 111. Or maybe systemd is not respecting my wishes to disable the unused service. Or maybe something else…

How do I determine what is trying to listen on the port, and how do I disable it?


From below:

$ sudo systemctl -a | grep -E "rpc|port"
  var-lib-nfs-rpc_pipefs.mount          loaded    active   mounted   RPC Pipe File System
  abrtd.service                         loaded    active   running   ABRT Automated Bug Reporting Tool
  auth-rpcgss-module.service            loaded    inactive dead      Kernel Module supporting RPCSEC_GSS
  fedora-import-state.service           loaded    active   exited    Import network configuration from initramfs
  fedora-readonly.service               loaded    active   exited    Configure read-only root support
  rpc-gssd.service                      loaded    inactive dead      RPC security service for NFS client and server
  rpc-statd-notify.service              loaded    inactive dead      Notify NFS peers of a restart
  rpc-statd.service                     loaded    inactive dead      NFS status monitor for NFSv2/3 locking.
● rpc-svcgssd.service                   not-found inactive dead      rpc-svcgssd.service
  rpcbind.service                       loaded    inactive dead      RPC Bind
  rpcbind.socket                        loaded    active   listening RPCbind Server Activation Socket
  rpc_pipefs.target                     loaded    active   active    rpc_pipefs.target
  rpcbind.target                        loaded    active   active    RPC Port Mapper

Best Answer

When you run sudo systemctl disable rpcbind on Fedora 25 I think there is a warning:

Warning: Stopping rpcbind.service, but it can still be activated by:
rpcbind.socket

So you can try following:

sudo systemctl stop rpcbind.socket
sudo systemctl disable rpcbind.socket
Related Question