Ubuntu

誰監聽埠

  • August 29, 2019

我在郵件伺服器和另外一項服務之間存在衝突。

netstat -ltnp | grep -w ': 25'

結論:

(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?

我修好了它:

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  

如果您不是 root 並且不是程序所有者,則無法在已棄用netstat(或 current )輸出中看到程序。ss

要查看所有程序的程序資訊,您需要以 root 身份執行它,例如使用sudo. 例如:

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

引用自:https://serverfault.com/questions/981221