Close tcp port with no process

5,154

Try netstat -ltpn | grep 8888

Share:
5,154

Related videos on Youtube

jarekrozanski
Author by

jarekrozanski

Updated on September 18, 2022

Comments

  • jarekrozanski
    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
      SpacemanSpiff almost 13 years
      service networking restart ?
    • Jodie C
      Jodie C almost 13 years
      Do 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
    Jodie C almost 13 years
    also look at rpcinfo -p
  • poige
    poige almost 13 years
    _______ Also not
  • Jodie C
    Jodie C almost 13 years
    As well what do you mean?
  • poige
    poige almost 13 years
    I meant that netstat is enough to answer to original question.
  • Jodie C
    Jodie C almost 13 years
    It 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
    poige almost 13 years
    @Jodie C, RPC is remote-proc-call, user-level, actually.
  • jarekrozanski
    jarekrozanski almost 13 years
    Run it, returns no output.
  • jarekrozanski
    jarekrozanski almost 13 years
    I am the owner of the process. Do I need to be the root to find my own process?
  • loopforever
    loopforever almost 13 years
    You 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
    Jodie C almost 13 years
    sunrpc, lockd, nfsd, exportfs are all Linux kernel modules. Try running netstat -plant on an NFS server.
  • poige
    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
    Jodie C almost 13 years
    they are kernel modules and the init scripts for nfs-kernel-server on Debian/Ubuntu simply run modprobe nfsd. Have you used NFS before?
  • poige
    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 :-)