I have Linux server running a unauthorized process (which I do not know the name of) which is doing a port scan from the server out to the internet.

How do I find out which process this is and kill it!


3 Answers 3


Look at the lsof output and track down the process that is opening a large number of possibly sequential port numbers.

  • 2
    If course that is assuming that lsof or the kernel hasn't been patched by the unauthorized process so it won't be displayed.
    – Zoredache
    Mar 19, 2010 at 18:26
  • Yeah, that's exactly correct. If it turns out to be a rooted machine, you can always try a fresh install of lsof or rebooting into a "known good" kernel. But at that point, your best bet is usually the installation CD and a late night.
    – McJeff
    Mar 19, 2010 at 18:28
  • 1
    The syntax should be lsof -i or netstat -anp Mar 19, 2010 at 18:55

If your system has been compromised there may be no possible way to identify and kill the process. Your only recourse may be to restart the machine from clean media and start your a scan/restore/rebuild.

See: Aftermath of a hack


netstat -l -p -d may give interesting result if the machine is not rootkitted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.