![]() |
NETWORKING-ID Ports & Process(es) Binding Them
Document Version:1.1 - 10/11/00
By: Myles
Green
From tips supplied by David
Bandel , Kurt Wall
and Bruce Marshall
Tested on COL eServer 2.3 using the stock kernel binaries and runing Webmin, XDMCP and supplying NAT services to a small home network.
[mylesg@router mylesg]$
su
Password:
[root@router mylesg]# netstat
-l <<see man netstat
for more information>>
Active Internet connections (only
servers)
Proto
Recv-Q Send-Q Local Address Foreign
Address State
tcp 0 0 *:printer *:*
LISTEN
tcp 0 0 *:6000 *:*
LISTEN
tcp 0 0 *:1389 *:*
LISTEN
tcp 0 0 *:1000 *:*
LISTEN
tcp 0 0 *:sunrpc *:*
LISTEN
udp 0 0 *:xdmcp *:*
udp 0 0 *:sunrpc *:*
raw 0 0 *:icmp *:* 7
raw 0 0 *:tcp *:* 7
Active UNIX domain sockets (only
servers)
Proto RefCnt Flags Type State I-Node
Path
unix 0 [ ACC ] STREAM LISTENING
58462 /tmp/.X11-unix/X0
unix 0 [ ACC ] STREAM LISTENING
82670 /tmp//kio_500_3883merlin_1.0
unix 0 [ ACC ] STREAM LISTENING
82672 /tmp//kfm_500_3883merlin_1.0
But wait!! What's that? Open ports? What is using those ports you ask yourself? So you consult with various RFC's and the Well Known Ports list (also found here) to find out, and they tell you something like: "iclpv-dm Document Manager". But of course! :-/ What is it? Where did it come from?
fuser -n tcp <port number><<see man fuser for more information>>
This will spit back a line containing the port number and the PID(s) using it, like this:
<port number>/tcp<<or udp>> $PID
Ok, let's try it on the ports listed in the above example:
[root@router mylesg]# fuser -n tcp
6000
6000/tcp: 24624
[root@router mylesg]# fuser -n tcp
1389
1389/tcp: 3835 3841 3862 3883 3885 3886 3887 15590 15835
24624 24628
[root@router mylesg]# fuser -n tcp
1000
1000/tcp: 589
ps ax | grep $PID <<substitute $PID with the values returned from fuser in the previous step>>
The result is the process that's binding the port(s) in question:
<<see man ps and man grep for more information>>
[root@router mylesg]# ps ax | grep
24624
24624 ? S 0:02 /usr/X11R6/bin/X -auth
/etc/X11/kdm/authdir/A:0-vU7lS
[root@router mylesg]# ps ax | grep
589
589 ? SW 0:00 [miniserv.pl]
[root@router mylesg]# ps ax | grep
3835
3835 ? S 0:00 -merlin:1
17593 pts/0 S 0:00 grep 3835