Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm running a RedHat 5.5 and I was wondering how I can identify a port to a process.

This is the output of netstat and I am trying to find the process associated with port 35670:

$ netstat -tulnp
tcp        0      0 0.0.0.0:35670               0.0.0.0:*                   LISTEN      -

I tried the following to get the associated process to this port but to no avail:

$ lsof -nl | grep TCP
$ fuser 35670/tcp

This finally worked for me.

$ rpcinfo -p
100021    3   tcp  35670  nlockmgr

Without doing the command above, how would you have detected that port 35670 is associated with nlockmgr.

The weird thing is nlockmgr does not show up when I do this:

$ ps aux

Thanks for your help in advance.

share|improve this question
1  
Of course there is one possibility why a process would not show up with the standard tools, but still be present. If your system has a rootkit, then processes could be running that would occasional appear to be invisible, and the standard tools may display unusual results. –  Zoredache Nov 30 '11 at 21:35
    
I thought of rootkit as well, but rpcinfo -p gave me the process name associated with it. So, I removed the idea that it could be a rootkit. –  Carmen Nov 30 '11 at 21:52
add comment

2 Answers 2

up vote 1 down vote accepted

You can use nmap with -sV option to determine service info:

# nmap -sV -p 35670 localhost

Why is rpc.lockd obscured from netstat/lsof output?

share|improve this answer
    
awesome! this works! –  Carmen Dec 1 '11 at 18:36
add comment

You have to execute netstat -tulnp as root. Otherwise you get the - instead of the process name.

This is what the manpage says:

PID/Program name
   Slash-separated pair of the process id (PID) and process name of the process that owns the socket.  --program causes  this  column
   to  be  included.   You will also need superuser privileges to see this information on sockets you don't own.  This identification
   information is not yet available for IPX sockets.

With one exception: portmapper See this

share|improve this answer
    
I did execute all of the commands as root. –  Carmen Nov 30 '11 at 21:28
    
After googling around, nlockmgr uses IPX socket which is why netstat could not identify the process. Thanks. But if netstat cannot detect process associated with IPx, what program can do it? –  Carmen Nov 30 '11 at 21:41
1  
carmen, your example shows $, which is not root. –  Sirex Dec 1 '11 at 13:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.