HTTPfy

Port 5432 (PostgreSQL)

PostgreSQL client connections; also used by many Postgres-compatible databases (CockroachDB uses 26257, but Aurora, Neon, Supabase and Timescale use 5432).

Registered (user) port, 1024-49151 TCP Databases Do not expose to the internet

What port 5432 is used for

PostgreSQL client connections; also used by many Postgres-compatible databases (CockroachDB uses 26257, but Aurora, Neon, Supabase and Timescale use 5432).

Security: should port 5432 be open?

Do not expose to the internet. Do not expose it publicly. Set listen_addresses to the needed interfaces only, use scram-sha-256 in pg_hba.conf, and never allow 'trust' for remote hosts. Exposed Postgres instances are hunted by cryptomining botnets that log in with weak passwords and run COPY ... FROM PROGRAM.

IANA assignment

Service nameProtoDescriptionAssigneeReference
postgresql TCP PostgreSQL Database Tom Lane -
postgresql UDP PostgreSQL Database Tom Lane -

Check what is listening on port 5432

Linux: is anything listening on TCP 5432?
sudo ss -tlnp 'sport = :5432'
Linux / macOS: which process owns the port
sudo lsof -nP -i :5432
Older Linux / BSD (net-tools)
sudo netstat -tlnp | grep ':5432 '
Windows (Command Prompt)
netstat -ano | findstr :5432
Windows (PowerShell)
Get-NetTCPConnection -LocalPort 5432 -State Listen | Select LocalAddress,OwningProcess

Test it from outside

From another machine
nc -vz -w 5 HOST 5432
From Windows
Test-NetConnection HOST -Port 5432

Block port 5432 in the firewall

ufw
sudo ufw deny 5432/tcp
iptables
sudo iptables -A INPUT -p tcp --dport 5432 -j DROP
nftables
sudo nft add rule inet filter input tcp dport 5432 drop
Windows Firewall
New-NetFirewallRule -DisplayName 'Block TCP 5432' -Direction Inbound -Protocol TCP -LocalPort 5432 -Action Block

Related ports

All port numbers · Open port checker
Assignment data: IANA port number registry (public domain), retrieved 2026-11-10.