Q:>I want to know process that locked port

Q:>I want to know process that locked port

Post by ngk » Fri, 02 Nov 2001 16:14:09



Hi,
I have a question.
For UNIX System, how can I know the process locked port?
If I want to know  which process control port, what command is
used?
 
 
 

Q:>I want to know process that locked port

Post by Michael Heimin » Fri, 02 Nov 2001 18:53:40






>> Hi,
>> I have a question.
>> For UNIX System, how can I know the process locked port?
>> If I want to know  which process control port, what command is
>> used?

> There isn't a command that will tell you which process has a port
> open but there is a freeware program you can download called lsof
> (list of
> open files).  Try ftp://vic.cc.purdue.edu/pub/tools/unix/lsof/

netstat can do this, however, it depends on your netstat version, how
usefull the output may be.

# netstat -V
net-tools 1.60
netstat 1.42 (2001-04-15)
Fred Baumgarten, Alan Cox, Bernd Eckenfels, Phil Blundell, Tuan Hoang
and others
+NEW_ADDRT +RTF_IRTT +RTF_REJECT +FW_MASQUERADE +I18N
AF: (inet) +UNIX +INET +INET6 +IPX +AX25 +NETROM +X25 +ATALK -ECONET
-ROSE
HW:  +ETHER +ARC +SLIP +PPP +TUNNEL +TR +AX25 +NETROM +X25 +FR -ROSE
-ASH +SIT +FDDI +HIPPI -HDLC/LAPB

Michael Heiming

 
 
 

Q:>I want to know process that locked port

Post by Dragan Cvetkovi » Sat, 03 Nov 2001 01:08:59



> netstat can do this, however, it depends on your netstat version, how
> usefull the output may be.

> # netstat -V
> net-tools 1.60
> netstat 1.42 (2001-04-15)
> Fred Baumgarten, Alan Cox, Bernd Eckenfels, Phil Blundell, Tuan Hoang
> and others
> +NEW_ADDRT +RTF_IRTT +RTF_REJECT +FW_MASQUERADE +I18N
> AF: (inet) +UNIX +INET +INET6 +IPX +AX25 +NETROM +X25 +ATALK -ECONET
> -ROSE
> HW:  +ETHER +ARC +SLIP +PPP +TUNNEL +TR +AX25 +NETROM +X25 +FR -ROSE
> -ASH +SIT +FDDI +HIPPI -HDLC/LAPB

Let's see:
$ netstat -V
netstat: illegal option -- V
usage: netstat [-anv] [-f address_family]
       netstat [-g | -p | -s] [-n] [-f address_family] [-P protocol]
       netstat -m
       netstat -i [-I interface] [-an] [-f address_family] [interval]
       netstat -r [-anv] [-f address_family]
       netstat -M [-ns] [-f address_family]
       netstat -D [-I interface] [-f address_family]
$ which netstat
netstat is /bin/netstat
$ uname -vr
SunOS 5.8

I would say that netstat you were talking about is Linux specific so it
seems that lsof is the answer.

Bye, Dragan

--
Dragan Cvetkovic,

To be or not to be is true. G. Boole

 
 
 

Q:>I want to know process that locked port

Post by Michael Heimin » Sat, 03 Nov 2001 02:53:47



November 2001 17:08:


>> netstat can do this, however, it depends on your netstat version,
>> how usefull the output may be.

>> # netstat -V
>> net-tools 1.60
>> netstat 1.42 (2001-04-15)
>> Fred Baumgarten, Alan Cox, Bernd Eckenfels, Phil Blundell, Tuan
>> Hoang and others
>> +NEW_ADDRT +RTF_IRTT +RTF_REJECT +FW_MASQUERADE +I18N
>> AF: (inet) +UNIX +INET +INET6 +IPX +AX25 +NETROM +X25 +ATALK
>> -ECONET -ROSE
>> HW:  +ETHER +ARC +SLIP +PPP +TUNNEL +TR +AX25 +NETROM +X25 +FR
>> -ROSE -ASH +SIT +FDDI +HIPPI -HDLC/LAPB

> Let's see:
> $ netstat -V
> netstat: illegal option -- V
> usage: netstat [-anv] [-f address_family]
>        netstat [-g | -p | -s] [-n] [-f address_family] [-P protocol]
>        netstat -m
>        netstat -i [-I interface] [-an] [-f address_family]
>        [interval] netstat -r [-anv] [-f address_family]
>        netstat -M [-ns] [-f address_family]
>        netstat -D [-I interface] [-f address_family]
> $ which netstat
> netstat is /bin/netstat
> $ uname -vr
> SunOS 5.8

> I would say that netstat you were talking about is Linux specific so
> it seems that lsof is the answer.

> Bye, Dragan

#netstat -an | grep 25
tcp        0      0  *:25         *:*               LISTEN

#grep 25 /etc/services
smtp    25/tcp  mail

#uname -a
OSF1 <hostname> V4.0 alpha

Looks like an additional 'ps -ef' should verify that sendmail has
bound to port 25. Solaris should behave equal, even if it's easier
with Linux, you can use 'netstat'.
Sure 'lsof -i tcp:25' would be faster, but it's not standart on most
systems.

Michael Heiming

 
 
 

1. Wanted: <><><> Unix Specialist <><><>

PERMANENT, FULL-TIME, POSITION.

Attractive Palm Beach County, Florida Location.    MAJOR EMPLOYER.

<><><>  UNIX SPECIALIST <><><>

-- AIX, SCO Preferred
-- Programming Background Preferred
-- Knowledge of INFORMIX  a real plus

FOR CONFIDENTIAL CONSIDERATION, PLEASE CONTACT:
(resumes..in .txt format please..before calls...please)

Richard
ENTERPRISE SOFTWARE STRATEGIES, INC.

Toll-free Voice: 1-800-624-2944
Toll-free Fax:   1-800-470-3751
Voice:            1-561-998-2823
Fax:              1-561-995-0699


2. kernel for PPP

3. Wanted: Pipe child -> process -> parent

4. em1nemk1t@yahoo.com

5. HELP Port Forwarding on Linux: Dest Port Known, Source Port High (1024-65535)

6. gcc (Segmentation fault)

7. I would know process id or name of using tcp or udp port at solaris.

8. add me to unix mailing list

9. 3 Qs - lock file, sound, mounting CD-ROM

10. USB> How do I know which port?

11. AUDIT: client 8 rejected from IP <ip> port <port> ????

12. qpopper and sendmail ports on FreeBSD 3.x : locking process ?

13. Qs on attack by high rate process creation