I am using a Busybox distro and I don't have iptables. I would like to discover what processes open the ports: 8001 and 35292 to kill them and close that ports.
root@(none):/proc/1709/net# netstat -a | grep LISTEN
netstat: /proc/net/tcp6: No such file or directory
tcp 0 0 (null):8001 (null):* LISTEN
tcp 0 0 (null):rmiregistry (null):* LISTEN
tcp 0 0 (null):ssh (null):* LISTEN
tcp 0 0 (null):35292 (null):* LISTEN
Many thanks in advance
Doubt solved with the parameter -p:
root@(none):~# netstat -a -p
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 (null):8001 (null):* LISTEN 1527/java
tcp 0 0 (null):8002 (null):* LISTEN 1527/java
tcp 0 0 (null):56618 (null):* LISTEN 1527/java
tcp 0 0 (null):rmiregistry (null):* LISTEN 1527/java
tcp 0 0 (null):ssh (null):* LISTEN 1181/dropbear
tcp 0 0 (null):telnet (null):* LISTEN 1166/telnetd
tcp 0 0 (null):ssh (null):55960 ESTABLISHED 1549/dropbear
From man netstat
:
-p, --program
Show the PID and name of the program to which each socket belongs.
By adding the -p
option, you'll get the PIDs of the programs listening. That's fairly enough to use ps
afterwards :
ps -ef | grep [your-pid]
Not sure if your question is programming-specific though. I would recommend Unix & Linux, or Server Fault (among others).