2

I'm trying to kill the process associated with port 161 (SNMP) on OS X.

I tried to get the process ID associated with this port using netstat and lsof but none of these seem to list PIDs:

$ netstat -an | grep 161
udp4       0      0  *.161                  *.*

$ netstat -anp udp | grep 161
udp4       0      0  *.161                  *.*   

lsof -i :161
Adrian Frühwirth
  • 35,499
  • 8
  • 54
  • 69
anish
  • 5,378
  • 10
  • 54
  • 119

1 Answers1

0

SNMP is UDP, not TCP. It does't "listen" because there is no such concept for UDP sockets.

Look for the process by its name or process ID instead.

tripleee
  • 139,311
  • 24
  • 207
  • 268
  • Technically this is not correct, [there is SNMP over TCP](https://tools.ietf.org/html/rfc3430) but it's not commonly implemented. `snmpd` does seem to implement TCP (see `man snmpd`) and its man page even states *"By default, snmpd listens for incoming SNMP requests on UDP port 161 on all IPv4 interfaces."* however unlucky that wording might be. "listen" != `listen()`. The information OP is after *can* be retrieved using `netstat -anup | grep :161`, just not on OS X. – Adrian Frühwirth Apr 23 '14 at 12:44