The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > Security
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 11-24-2006
DraconianTimes's Avatar
DraconianTimes DraconianTimes is offline
Registered User
 

Join Date: Jul 2004
Location: United Kingdom
Posts: 23
fstat might help you here. In OpenBSD,
Code:
fstat | grep ':22' | awk '{print $3}' | uniq
This will search the fstat output for port 22, and then awk will give you the third column which is the PID for the process bound to the specified port. Replace 22 with whatever port number you are binding to (don't forget to leave in the colon symbol) and you should get the info you need. Column output and command line switches might be different! =)

Nick
Reply With Quote