Finding out what services run on a specific port

xjamesx

Registered
I've been trying to lock down my machine and cutting off any ports I'm not using. I've been using Brickhouse to seal off anything I'm not using. I don't know if it's actually working or not.

I do a port scan (from the Network Utility) and it says I have port 80 and 49367 open. I know that I've set rules for web and ssh to be open.

I don't know what needs post 49367 open or how I would go about finding what is using it.

Is there a better way to do this from the terminal?
 
To find out which process is using a given port, use lsof in Terminal:

Code:
$ sudo lsof -i :22
COMMAND   PID USER   FD   TYPE     DEVICE SIZE/OFF NODE NAME
sshd      268 root    3u  inet 0x01a87f8c      0t0  TCP *:ssh (LISTEN)

Simply replace the 22 above with your port number, and look for the entry with LISTEN (as shown above) as there may be other, active connections shown as well.
 
Back
Top