I ended up in situation with a TCP port in listen mode with no process assigned to it.

Is there a way to close this port without restarting server?

Checking port status:

me> netstat -tan | grep 8888
tcp        0      0 :::8888                :::*                    LISTEN

Looking for process responsible:

me> lsof -i -P | grep 8888

Above command returns nothing

link|improve this question
service networking restart ? – SpacemanSpiff Jul 15 '11 at 16:34
Do you have zombie procs open? You seem to know which process opened the port. Maybe you should run ps -ef to grep for the process in question, then kill its parent PID. – Jodie C Jul 16 '11 at 15:26
feedback

3 Answers

Try netstat -ltpn | grep 8888

link|improve this answer
2  
also look at rpcinfo -p – Jodie C Jul 15 '11 at 17:02
_______ Also not – poige Jul 15 '11 at 17:09
As well what do you mean? – Jodie C Jul 15 '11 at 20:25
I meant that netstat is enough to answer to original question. – poige Jul 16 '11 at 2:54
1  
@Jodie C, I've installed NFS utils, and I should admit you were right — I see [nfsd] running in kernel mode, and there're several TCP ports w/o indicated owner in netstat's output. So, you were right, rpcinfo -p is worth noting as well. Thanks :-) – poige Jul 16 '11 at 14:46
show 5 more comments
feedback

run a

fuser 8888/tcp

That should list pids running on the port.

link|improve this answer
Run it, returns no output. – jarekrozanski Jul 16 '11 at 9:54
feedback

You are describing an impossible scenario.

I believe what the previous posters are missing is the fact that you are trying to map a port to a process which you do not own. Therefore your lsof returns nothing since those tools do not have permission view the /proc entries that would facilitate that port -> PID mapping. Your netstat command is lacking a -p flag as well. Run those commands as root then things will be much clearer.

link|improve this answer
I am the owner of the process. Do I need to be the root to find my own process? – jarekrozanski Jul 16 '11 at 9:55
You do not need to be root to see your own processes. You can prove my theory wrong by running sudo netstat -antp | grep 8888 and posting the output. Then we can stop guessing at what the problem is. – loopforever Jul 16 '11 at 11:26
feedback

Your Answer

 
or
required, but never shown

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