Process for a given tcp/udp port ?

Process for a given tcp/udp port ?

Post by Thomas Geber » Tue, 21 Jul 1998 04:00:00



Hello !
I'm searching for a method to find out which process occupies a given
tcp or udp
port.

For example :

searching for the udp port 162 you will get in most cases :

snmpd (or its pid)

Is there any chance to do this ? I read the man page about the /proc
filesystem
but found nothing to start with.

Perhaps in a newer kernel ( I'm using 2.0.18 ) ?

Answers also per mail to me, please !

Thanks in advance

Thomas Gebert
--
O===========================O================================================O
|                           | Thomas Gebert, IP 21 F, Siemens BS,
Germany    |
|                           | Phone at work :              +49 911 978
3318  |
|                           | Priv. snail-mail : Aachener Str.
11            |
|                           |                    90425
Nuernberg             |
|       o                   |
GERMANY                     |
|    \_O_ \O                | EMail:

|      \\'#\\               |

|   O  // #//           O   |

|  /\     |             /\  |
WWW:                                           |
|_/|______|______________<\_|                   |
O===========================O================================================O
|   Volleyball is great !   | LINUX: the greatest textadventure of the
wor

 
 
 

Process for a given tcp/udp port ?

Post by felicity+s.. » Tue, 21 Jul 1998 04:00:00



Quote:> Is there any chance to do this ? I read the man page about the /proc
> filesystem
> but found nothing to start with.

The list of "known" ports on your system will be listed in /etc/services.

--
To reply via mail, please remove the obvious from the email address.

 
 
 

Process for a given tcp/udp port ?

Post by Thomas Geber » Tue, 21 Jul 1998 04:00:00




> > Is there any chance to do this ? I read the man page about the /proc
> > filesystem
> > but found nothing to start with.

> The list of "known" ports on your system will be listed in /etc/services.

I know this. But if some crazy process occupies for example port 162 with
protocoludp I want to know what is the pid or name of this process.

/etc/services only gives a name for a port number so that a program can get
a
specific port by name.

For example :
netstat gives the service names if it can get it from /etc/services.

So this is not enough for me, but thanks.

--
O===========================O================================================O
|                           | Thomas Gebert, IP 21 F, Siemens BS, Germany    |
|                           | Phone at work :              +49 911 978 3318  |
|                           | Priv. snail-mail : Aachener Str. 11            |
|                           |                    90425 Nuernberg             |
|       o                   |                    GERMANY                     |



|  /\     |             /\  | WWW:                                           |
|_/|______|______________<\_|                   |
O===========================O================================================O
|   Volleyball is great !   | LINUX: the greatest textadventure of the wor

 
 
 

Process for a given tcp/udp port ?

Post by Vic Abe » Tue, 21 Jul 1998 04:00:00





>> > Is there any chance to do this ? I read the man page about the /proc
>> > filesystem
>> > but found nothing to start with.

>> The list of "known" ports on your system will be listed in /etc/services.
>I know this. But if some crazy process occupies for example port 162 with
>protocoludp I want to know what is the pid or name of this process.
>/etc/services only gives a name for a port number so that a program can get
>a
>specific port by name.
>For example :
>netstat gives the service names if it can get it from /etc/services.
>So this is not enough for me, but thanks.

Try:

        $ lsof -i:162

Lsof is available (including source code) at:

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

and (perhaps closer to you) at these .de mirrors:

        ftp://ftp.fu-berlin.de/pub/unix/tools/lsof
        ftp://ftp.uni-mainz.de/pub/misc/lsof

Revision 4.35 is the latest.


 
 
 

Process for a given tcp/udp port ?

Post by Paul Russel » Thu, 23 Jul 1998 04:00:00





> > > Is there any chance to do this ? I read the man page about the /proc
> > > filesystem
> > > but found nothing to start with.

fuser

Caveat: the one I have doesn't seem to work on 2.1.x kernels...
Rusty.
--
 .sig lost in the mail

 
 
 

1. ipchains/TCP/UDP, Why should I open UDP ports so that my TCP ports can work?

Hi,

I have set up firewall to accept some ports.
/sbin/ipchains -F input
/sbin/ipchains -P input ACCEPT
/sbin/ipchains -A input -p TCP -s 0/0 --dport ssh -j ACCEPT
/sbin/ipchains -A input -p UDP -s 0/0 --dport ssh -j ACCEPT
....

Then I want to lock down all other ports.
/sbin/ipchains -A input -p TCP -s ! 192.168.0.0/24 -j DENY

#??? what's wrong with this UDP ???
/sbin/ipchains -A input -p UDP -s ! 192.168.0.0/24 -j DENY

If I comment out the UDP line, I can ssh into firewall from outside.
If I don't comment out that line, I can no longer ssh into firewall from
outside.

Why should I open UDP ports so that my TCP ports can work?

Thanks for any help.

Ed Wu

2. PCI Firewire host adapters for Ultra 5/10?

3. How to determine which process uses which tcp/udp port?

4. Win95 OSR 2.1 CD $35 W/Fat32, Fat converter, Full install

5. Finding process associated with TCP/UDP port...

6. ipchains mfw

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

8. jdk1.2 and compat_linux

9. How to find process which uses the given TCP port?

10. Ports 137/udp and 138/udp are in use but no process can be found

11. UDP/TCP ports -> protocol port

12. Hacked? TCP port 12345 and UDP port 2364

13. Ignore all incoming udp/ip and udp/ip on all ports, except open ports?