Close tcp port with no process
5,154
Try netstat -ltpn | grep 8888
Related videos on Youtube
Author by
jarekrozanski
Updated on September 18, 2022Comments
-
jarekrozanski almost 2 years
I ended up in situation with a TCP port in listen mode with no process assigned to it.
Is there a way to close this port without restarting server?
Checking port status:
me> netstat -tan | grep 8888 tcp 0 0 :::8888 :::* LISTEN
Looking for process responsible:
me> lsof -i -P | grep 8888
Above command returns nothing
-
SpacemanSpiff almost 13 yearsservice networking restart ?
-
Jodie C almost 13 yearsDo you have zombie procs open? You seem to know which process opened the port. Maybe you should run
ps -ef
to grep for the process in question, then kill its parent PID.
-
-
Jodie C almost 13 yearsalso look at
rpcinfo -p
-
poige almost 13 years_______ Also not
-
Jodie C almost 13 yearsAs well what do you mean?
-
poige almost 13 yearsI meant that
netstat
is enough to answer to original question. -
Jodie C almost 13 yearsIt won't answer the question if the port is opened by the kernel alone.
netstat
has no knowledge of the source of kernel portmap. -
poige almost 13 years@Jodie C, RPC is remote-proc-call, user-level, actually.
-
jarekrozanski almost 13 yearsRun it, returns no output.
-
jarekrozanski almost 13 yearsI am the owner of the process. Do I need to be the root to find my own process?
-
loopforever almost 13 yearsYou do not need to be root to see your own processes. You can prove my theory wrong by running
sudo netstat -antp | grep 8888
and posting the output. Then we can stop guessing at what the problem is. -
Jodie C almost 13 yearssunrpc, lockd, nfsd, exportfs are all Linux kernel modules. Try running
netstat -plant
on an NFS server. -
poige almost 13 years@Jodie C, I have no one, alas. Nevertheless, lockd/nfsd aren't kernel modules. They use kernel level parts.
-
Jodie C almost 13 yearsthey are kernel modules and the init scripts for nfs-kernel-server on Debian/Ubuntu simply run
modprobe nfsd
. Have you used NFS before? -
poige almost 13 years@Jodie C, I've installed NFS utils, and I should admit you were right — I see [nfsd] running in kernel mode, and there're several TCP ports w/o indicated owner in netstat's output. So, you were right,
rpcinfo -p
is worth noting as well. Thanks :-)