Fun fact about netstat

24年 9月 29日 Sunday
118 words
1 minutes
text
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:20048           0.0.0.0:*               LISTEN      285221/rpc.mountd
tcp        0      0 0.0.0.0:33409           0.0.0.0:*               LISTEN      102039/rpc.statd
tcp        0      0 0.0.0.0:2049            0.0.0.0:*               LISTEN      -

I'm aware that running netstat without root privilage can hide some PID, but I ran netstat as root, then why some LISTEN port doesn't have PID, how come?

after searching a while on the Internet, I assume it's because the LISTEN port is managed by the kernel itself (?)

I tried using the lsof command, but still can't identify the PID, and finally I was able to figure it out using rpcinfo -p command.

and turns out, the service that responsible for port 2049 is nfs.

Title:Fun fact about netstat

Author:ReYuki

Link:https://www.reyuki.site/posts/fun-fact-about-netstat [copy]

Last updated:


This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. You are free to share and adapt it, as long as you give appropriate credit, don’t use it for commercial purposes, and distribute your contributions under the same license. Provided under license CC BY-NC-SA 4.0