On Thu, 24 Jun 1999, Bryan Andersen wrote:

> Anybody know how to findout which process has what ports open under 
> Linux or OpenBSD?  Or for that matter any other OS.

Compile and install a copy of lsof.   The program will list *all* open 
filehandles on the box, as well as the process with them open.  Sockets 
are filehandles too.  You'll be able to list Unix domain (named pipes), 
Internet domain and regular filehandles at will.  It's one of those 
few programs I consider a necessary install on any *nix box I administer.

ftp://vic.cc.purdue.edu/pub/tools/unix/lsof/

You want a version > 4.40 and probably to make sure only select users can 
execute it anyway.  V4 is currently tested on:

        AIX 4.1.[45], 4.2[.1], and 4.3[.12]
        BSDI BSD/OS 2.1 and 3.[01] for Intel-based systems
        DC/OSx 1.1 for Pyramid systems
        DEC OSF/1, Digital UNIX, Tru64 UNIX 2.0, 3.2, 4.0, and 5.0
        FreeBSD 2.1.[67], 2.2[.x], 3.[012], and 4.0 for Intel-based
           systems
        HP-UX 9.01, 10.20, and 11.00
        Linux 2.0.3[2346], 2.1.x, and 2.2.x for Intel-based systems
        NetBSD 1.[234] for Intel and SPARC-based systems
        NEXTSTEP 3.[13] for NEXTSTEP architectures
        OpenBSD 2.[012345] for Intel-based systems
        OpenStep 4.x
        Reliant UNIX 5.4[34] for Pyramid systems
        SCO OpenServer Release 3.0 and 5.0.[0245] for Intel-based
            systems
        SCO UnixWare 2.1.[123] and 7[[.0].1] for Intel-based systems
        Sequent PTX 2.1.9, 4.2.[13], 4.[34], and 4.4.[124]
        Solaris 2.5.1, 2.6, and 7
        SunOS 4.1.x
        Ultrix 4.2

Under Linux, /proc/net/{raw,tcp,udp,unix} will give you the UID of the 
owning process, I'm not sure if the PID is available or not having not 
dug though /proc in a while.

Paul
-----------------------------------------------------------------------------
Paul D. Robertson      "My statements in this message are personal opinions
[EMAIL PROTECTED]      which may have no basis whatsoever in fact."
                                                                     PSB#9280

-
[To unsubscribe, send mail to [EMAIL PROTECTED] with
"unsubscribe firewalls" in the body of the message.]

Reply via email to