GrepBoard/Manuals
51 manuals ·

See which process is listening on a port

·ss (iproute2) · Ubuntu 24.04 output · firewalld per RHEL 9 and firewalld docs (same family as Rocky 9)·4 steps

List listening TCP sockets with their processes, narrow to one port, and check that firewalld lets that port through.

On current distributions ss replaces netstat and is installed by default. The output in steps 1–2 was run on an Ubuntu 24.04 server (processes differ per host); step 3 follows the official firewalld documentation.

[1] List listening TCP sockets with their processes. -t TCP, -l listening, -n numeric, -p process. Run as root to see every process column.

console
# ss -tlnpState  Recv-Q Send-Q Local Address:Port Peer Address:Port ProcessLISTEN 0      4096      127.0.0.54:53        0.0.0.0:*    users:(("systemd-resolve",pid=668,fd=17))LISTEN 0      4096   127.0.0.53%lo:53        0.0.0.0:*    users:(("systemd-resolve",pid=668,fd=15))LISTEN 0      128          0.0.0.0:22        0.0.0.0:*    users:(("sshd",pid=883,fd=3))LISTEN 0      128             [::]:22           [::]:*    users:(("sshd",pid=883,fd=4))

[2] Show one port only.

console
# ss -tlnp 'sport = :22'State  Recv-Q Send-Q Local Address:Port Peer Address:Port ProcessLISTEN 0      128          0.0.0.0:22        0.0.0.0:*    users:(("sshd",pid=883,fd=3))LISTEN 0      128             [::]:22           [::]:*    users:(("sshd",pid=883,fd=4))

[3] A listening process can still be blocked by the firewall. List the services firewalld allows in the default zone. The output below is the example from the official documentation.

console
# firewall-cmd --list-servicesssh dhcpv6-client

[4] Add a service. A --permanent change takes effect after a reload, and a reload does not interrupt connections already established.

console
# firewall-cmd --permanent --add-service=http# firewall-cmd --reload

#ss#firewalld#network