Who listens to the port

I have a conflict between the mail server and one more service.

netstat -ltnp | grep -w ': 25'

Conclusion:

(Not all processes could be identified, non-owned process info
  will not be shown, you would have to be root to see it all.)
tcp6 0 0 ::: 25 ::: * LISTEN -
The problem is that I do not know who is listening on port 25. How can this be determined?

I fixed it:

sudo netstat -tulpn | grep LISTEN
[sudo] password for eurvanov: 
tcp        0      0 127.0.0.1:63342         0.0.0.0:*               LISTEN      2967/java           
tcp        0      0 127.0.0.1:5939          0.0.0.0:*               LISTEN      1445/teamviewerd    
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      583/systemd-resolve 
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      709/cupsd           
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      7935/master         
tcp        0      0 127.0.0.1:9050          0.0.0.0:*               LISTEN      955/tor             
tcp        0      0 127.0.0.1:6942          0.0.0.0:*               LISTEN      2967/java           
tcp        0      0 0.0.0.0:45577           0.0.0.0:*               LISTEN      2967/java           
tcp6       0      0 ::1:631                 :::*                    LISTEN      709/cupsd           
tcp6       0      0 :::25                   :::*                    LISTEN      7935/master         
tcp6       0      0 :::10012                :::*                    LISTEN      2199/docker-proxy  

Answer

You can’t see processes in deprecated netstat (or current ss) output if you are not root and aren’t the process owner.

To see the process information for all processes, you need to run it as root, e.g. with sudo. For example:

sudo netstat -ltnp | grep -w ': 25'

Attribution
Source : Link , Question Author : hedgehogues , Answer Author : Michael Hampton

Leave a Comment