kymbrik
2/9/2019 - 7:38 AM

Disable systemd listening on port 111

If your systemd listens on port 111 but you don't want that, please do the following steps:

Verify it's listening on port 111 with netstat or ss:

# ss -tpna|grep 111
LISTEN     0      128          *:111                      *:*                   users:(("systemd",pid=1,fd=39))
LISTEN     0      128         :::111                     :::*                   users:(("systemd",pid=1,fd=38))

Disable rpcbind:

# systemctl stop rpcbind

# systemctl disable rpcbind

# systemctl mask rpcbind

# systemctl stop rpcbind.socket

# systemctl disable rpcbind.socket

# systemctl status rpcbind
● rpcbind.service
   Loaded: masked (/dev/null; bad)
   Active: inactive (dead) since Sun 2017-12-17 15:31:11 CET; 3min 51s ago
 Main PID: 10920 (code=exited, status=0/SUCCESS)

Dec 13 13:28:35 sys.example.com systemd[1]: Starting RPC bind service...
Dec 13 13:28:35 sys.example.com systemd[1]: Started RPC bind service.
Dec 17 15:31:11 sys.example.com systemd[1]: Stopping RPC bind service...
Dec 17 15:31:11 sys.example.com systemd[1]: Stopped RPC bind service.

Verify it's no longer listening:

# ss -tpna|grep 111