Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
joe@server:~$ sudo lsof -i :36168
java    23059 activemq   15u  IPv6 109382      0t0  TCP *:36168 (LISTEN)

From the output above I want to disable port 36168, but don't know where. How can I exactly find the configuration file of this port to modify it?

grep ing for this doesn't give a result. And I don't want to use a firewall instead.

share|improve this question
In this case it was probably a dynamic port of activemq. Closing all connections to aptivemq and restart the service let the port disappear. – Joe Nazz Jul 20 '11 at 15:26
Would you mind selecting one of the answers? – GDR Sep 5 '11 at 21:23

From your lsof output, you have the PID number of the process which has the port open. Do ps -AH to see a hierarchical listing of processes and look for that specific PID. This process will be indented 'below' other processes, scan up the tree until you find the parent process (if you reach init you've gone too far, go back down one level).

Once you've identified the parent process, you should then be able to stop that process using your distribution's init scripts.

share|improve this answer
netstat -putan | grep 80 | grep LISTEN


tcp        0      0    *               LISTEN      1682/apache2 

As you can see, apache2 with PID=1682 is the process listening on port 80 in this example.

share|improve this answer

The well-known ports are in /etc/services. The port mentioned seems to be used by activemq, maybe it's not standardized. Please see the configuration of activemq, or the deployed webapps if it's running in web container. You can secure the installation if you make it bind on the local address ( or ::1). If you don't need activemq, simply stop the application.

share|improve this answer

I always found fuser easier

fuser 80/tcp

It will list all the pids running on port 80 using tcp

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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