Identificare le porte aperte in Linux

Mattepuffo's logo
Identificare le porte aperte in Linux

Identificare le porte aperte in Linux

In Linux abbiamo diversi modi per identificare le porte aperte sul nostro sistema.

Sicuramente i due comandi più usato sono ss e lsof.

Vediamo qualche esempio partendi dal primo:

$ sudo ss -tulpn
Netid   State    Recv-Q   Send-Q                           Local Address:Port        Peer Address:Port   Process                                     
udp     UNCONN   0        0                                      0.0.0.0:59607            0.0.0.0:*       users:(("kdeconnectd",pid=1008,fd=17))     
udp     UNCONN   0        0                                            *:60081                  *:*       users:(("kdeconnectd",pid=1008,fd=18))     
udp     UNCONN   0        0           [fe80::cb2f:23a0:9031:759c]%enp2s0:546                 [::]:*       users:(("NetworkManager",pid=532,fd=28))   
udp     UNCONN   0        0                                            *:1716                   *:*       users:(("kdeconnectd",pid=1008,fd=15))     
tcp     LISTEN   0        4096                                 127.0.0.1:631              0.0.0.0:*       users:(("cupsd",pid=589,fd=7))             
tcp     LISTEN   0        4096                                     [::1]:631                 [::]:*       users:(("cupsd",pid=589,fd=6))             
tcp     LISTEN   0        50                                           *:1716                   *:*       users:(("kdeconnectd",pid=1008,fd=16))     
tcp     LISTEN   0        100                                          *:7770                   *:*       users:(("java",pid=140604,fd=60))          
tcp     LISTEN   0        50                          [::ffff:127.0.0.1]:37083                  *:*       users:(("idea",pid=140382,fd=251))         
tcp     LISTEN   0        4096                        [::ffff:127.0.0.1]:44821                  *:*       users:(("idea",pid=140382,fd=244))         
tcp     LISTEN   0        4096                        [::ffff:127.0.0.1]:63342                  *:*       users:(("idea",pid=140382,fd=56))  

Oppure:

$ sudo ss -tulpn | grep :7770
tcp   LISTEN 0      100                                     *:7770             *:*    users:(("java",pid=140604,fd=60)) 

Con lsof:

$ sudo lsof -i :7770
COMMAND    PID   USER FD   TYPE DEVICE SIZE/OFF NODE NAME
java    140604 fermat 60u  IPv6 543901      0t0  TCP *:7770 (LISTEN)

Enjoy!


Condividi

Commentami!