Thursday, March 5, 2009

What is Port 898 on my CentOS box?

What is port 898 on my Linux CentOS box? Using the #nmap program, I was able to verify that on my system port 898 is open and the service name is "sun-manageconsole". Since I do not know what sun-manageconsole is, I issued the #lsof command to verify what open file is associated with it:

#lsof | grep 898

This gave me the information that its "rpc.statd". I did a quick google search on what rpc.statd is. Accordingly, this is run by the service "nfslock". Since on the server, you will not be using nfs, I quickly deactivated the service and remove it in my startup:

# /etc/rc.d/init.d/nfslock stop
# chkconfig --levels 2345 nfslock off

The next #nmap command no longer shows port 898, which gave a sigh of relief knowing no server process that I don't know about is running.

By the way, researching a bit further, I found out that "nfslock" may also run on other ports besides 898.

What process is running on the port?

Have you wondered what process is running on the port of your Linux box? The command to know the process that is running on the port is:

#lsof

This command comes handy with the #nmap program that identifies what ports are open. The command however tries to list all open files and therefore expect a long list to run through your screen. If you just want to investigate a particular port say port 898, use #lsof with grep:

#lsof | grep 898

This will list the open files with the particular port 898.

Knowing What Ports Are Open on Linux?

On Linux, it is easy to know what ports are open. You just need to use the program "nmap". If you don't have it on your system, download and install it using the command:

#apt-get install nmap

on your Ubuntu or using the yum for Fedora/RedHat/CentOS as follows:

#yum install nmap


Once installed, issue the command:

#nmap localhost

to know which ports are open in your computer.