The rpc.statd Linux Command

Learn about a key component of Linux's Network File System

The rpc.statd server implements the NSM (Network Status Monitor) RPC protocol. This service is somewhat misnamed since it doesn't actually provide active monitoring as one might suspect; instead, NSM implements a reboot notification service. It is used by the NFS file locking service,rpc.lockd, to implement lock recovery when the NFS server machine crashes and reboots.  

Developers Working In Their Office.
vgajic / Getty Images

Using rpc.statd

It used to be that, on some Linux distributions, you'd need to start rpc.statd separately when spinning up an NFS server. This was largely due to the old Sysvinit system. Now, you'll find that starting NFS will automatically start rpc.statd and any other components needed for the server to function properly.

systemctl start nfs

Or(Depending on your distribution)

systemctl start nfs-server

The same is true when enabling the server on startup. Debian-based distributions, like Ubuntu and Linux Mint will enable NFS as soon as you install it, so there's no need to do this, but enabling the server looks something like this:

systemctl enable nfs

Or

systemctl enable nfs-server

Again, the exact command depends on your distribution. The "nfs-server" one is a Debian-based system.

If you need to customize rpc.statd's behavior, you can do so with the options below. Generally, you won't want to run the command separately. Instead, you'd duplicate the Systemd service file, creating a backup of the original and a new copy to modify freely. Then, you'd change how the service is called from that service file using the options below.

Synopsis

/sbin/rpc.statd [-F] [-d] [-?] [-n name ] [-o port ] [-p port ] [-V]  

Operation

For each NFS client or server machine to be monitored, rpc.statd creates a file in/var/lib/nfs/statd/sm. When starting, it iterates through these files and notifies the peerrpc.statd on those machines. 

Options

-F

By default, rpc.statd forks and puts itself in the background when started. The -F argument tells it to remain in the foreground. This option is mainly for debugging purposes.

-d

By default, rpc.statd sends logging messages via syslog(3) to system log. The -d argument forces it to log verbose output to stderr instead. This option is mainly for debugging purposes, and may only be used in conjunction with the -F parameter.

-n, --name name

specify a name for rpc.statd to use as the local hostname. By default, rpc.statd will call gethostname(2) to get the local hostname. Specifying a local hostname may be useful for machines with more than one interfaces.

-o, --outgoing-port port

specify a port for rpc.statd to send outgoing status requests from. By default, rpc.statd will ask portmap(8) to assign it a port number. As of this writing, there is not a standard port number that portmap always or usually assigns. Specifying a port may be useful when implementing a firewall.

-p, --port port

specify a port for rpc.statd to listen on. By default, rpc.statd will ask portmap(8) to assign it a port number. As of this writing, there is not a standard port number that portmap always or usually assigns. Specifying a port may be useful when implementing a firewall.

-?

Causes rpc.statd to print out command-line help and exit.

-V

Causes rpc.statd to print out version information and exit.

TCP_WRAPPERS SUPPORT

This rpc.statd version is protected by the tcp_wrapper library. You have to give the clients access to rpc.statd if they should be allowed to use it. To allow connects from clients of the .bar.com domain you could use the following line in /etc/hosts.allow:

statd: .bar.com

You have to use the daemon name statd for the daemon name (even if the binary has a different name).

For further information please have a look at the tcpd(8) and hosts_access(5) manual pages.

See Also

Use the man command (% man) to see how a command is used on your particular computer.