
portmap Command in Linux
The portmap is a server (or daemon) that maps RPC (Remote Procedure Call) program numbers to DARPA protocol port numbers. It acts as an intermediary, allowing RPC-based services to register themselves dynamically with specific ports, which clients can then query to make remote procedure calls.
When an RPC server starts, it registers its port number and program number with portmap. A client needing to call an RPC program first asks portmap for the correct port, then sends RPC requests to that port.
Table of Contents
Here is a comprehensive guide to the options available with the portmap command â
- Syntax of portmap Command
- Options for portmap Command
- Examples of portmap Command in Linux
- Alternative to portmap Command
Note: The portmap service is primarily used in older Unix-based systems for services like NFS (Network File System) and has been replaced with rpcbind.
Syntax of portmap Command
The syntax of the portmap command in Linux is as follows:
portmap [options]
In the above syntax, the [options] field is used to specify different options to change the commandâs output.
Options for portmap Command
The options of the portmap command are listed below:
Option | Description |
---|---|
-d | Runs in debug mode, prints errors and debugging info to the terminal, and prevents running as a daemon. |
-l | Binds only to the loopback interface (127.0.0.1), restricting access to local connections. |
-v | Runs in verbose mode, displaying detailed logs of RPC service registrations and requests. |
Examples of portmap Command in Linux
This section explores how to use the portmap command in Linux with examples:
Running portmap in Debug Mode
To run the portmap command in the debug mode, use the -d option:
sudo portmap -d
Running portmap in Localhost Mode
To execute the portmap command in the localhost mode only, use the -l option:
sudo portmap -l
The above command binds the portmap only to the loopback interface 127.0.0.1, preventing external systems from accessing RPC services.
Running portmap in Verbose Mode
To execute the portmap command in the verbose mode, use the -v option:
sudo portmap -v
Alternative to portmap Command
Modern Linux systems use the rpcbind command instead of the portmap command. To use the rpcbind command on Linux, it must be installed.
Operating System | Command |
---|---|
Ubuntu, Kali Linux, Raspberry Pi OS, Debian | sudo apt install rpcbind |
Fedora | sudo dnf install rpcbind |
Arch Linux | sudo pacman -S rpcbind |
To confirm the installation, check the binary using the which command:
which rpcbind

Now, start and enable the rpcbind service:
sudo systemctl start rpcbind.service sudo systemctl enable rpcbind.service
To verify the status of the service, use the following command:
sudo systemctl status rpcbind.service

To check the RPC program mappings, use the command given below:
sudo rpcinfo -p

To run the rpcbind command in debug mode, use the -d option:
sudo rpcbind âd
The above command logs additional information. To abort it on an error, specify -a:
sudo rpcbind -a -d
To run rpcbind in the insecure mode, use the -i option:
sudo rpcbind -i
Conclusion
The portmap is a daemon that maps RPC program numbers to network ports, enabling clients to locate and communicate with RPC-based services. It was commonly used in older Unix systems, particularly for services like NFS, but has been replaced by rpcbind in modern Linux distributions.
The portmap command provides options for debugging, restricting access to localhost, and enabling verbose logging. For current systems, rpcbind serves as an alternative, offering similar functionality with additional security and compatibility improvements.