Every program that can be reached over the network listens on a port. After you have installed a few apps, it is worth checking which ports are open to the whole Internet and which only to the server itself. One command shows it. The commands were tested on Ubuntu 26.04 LTS; run them as root, so that you see the program names too.


1. List the Listening Programs

ss -tlnp

-t shows TCP, -l only listening ports, -n numbers instead of names, -p the program. The important columns are Local Address:Port and Process. Some example lines:

0.0.0.0:22        users:(("sshd",pid=23222,fd=3))
*:8080            users:(("qbittorrent-nox",pid=20404,fd=40))
*:22000           users:(("syncthing",pid=31736,fd=9))
127.0.0.1:8081    users:(("filebrowser",pid=26042,fd=7))
127.0.0.1:7878    users:(("docker-proxy",pid=27576,fd=7))

How to read the address in front of the port:

  • 0.0.0.0, [::] or *: all addresses of the server. The program can be reached from the Internet, unless a firewall blocks the port.
  • 127.0.0.1, 127.0.0.53 or [::1]: only from the server itself, for example through an SSH tunnel or a web server on the same machine.
  • A line with % and a name, such as %eno0: only on that network card.

In the example, SSH (22), qBittorrent (8080) and Syncthing (22000) are open to the Internet; File Browser (8081) and the Docker app on 7878 are not.

2. One Port, or UDP

  • Who uses port 8080: ss -tlnp 'sport = :8080'. Useful when a program does not start because the port is already in use.
  • UDP ports, for example of torrent clients or WireGuard: ss -ulnp.

3. Ports of Docker Containers

For containers, the list shows docker-proxy instead of the app. Docker itself shows which container it is:

docker ps --format "table {{.Names}}\t{{.Ports}}"

For example, radarr 127.0.0.1:7878->7878/tcp can be reached only from the server, while qbittorrent 0.0.0.0:6881->6881/tcp is open to everyone. To make a container port local only, write 127.0.0.1: in front of it in the compose file, for example "127.0.0.1:7878:7878", and run docker compose up -d again.

ℹ Docker and the firewall

Ports that Docker publishes are open even when ufw blocks them. For containers, choose the address in the compose file instead of relying on ufw.

4. Check From Outside

From your own computer (Linux, macOS or WSL), with the IP address of your server:

nc -zv 203.0.113.10 8080

succeeded (or open) means the port can be reached from the Internet. In the example above, port 8080 answers succeeded!, and port 7878, which listens only on 127.0.0.1, answers Connection refused.

5. Close What You Do Not Need


Related Guides

View all Linux guides

Was this answer helpful? 0 Users Found This Useful (0 Votes)