Linux ss Command: Spot Unauthorized Connections Fast
Use the Linux ss command for terminal forensics to find rogue sockets, reverse shells, and odd listeners. Practical DIY steps for Australian sole traders and small businesses—plus when to book Fixwebnode remotely.
If your Linux server or VPS feels “off”—slow shells, unexplained outbound traffic, or mystery processes—you need socket-level visibility before you reboot and lose evidence. This guide shows Australian homeowners, sole traders, and small-business operators how to use the built-in ss command for terminal forensics: spotting unauthorized connections, mapping them to processes, and deciding what to kill, block, or escalate.
Fixwebnode works as a direct remote specialist for this exact workflow. We help individuals and local operators across Australia inspect live sockets, correlate PIDs, and harden listeners without marketplace middlemen. Start here, run the checks below, then reach out via Fixwebnode website repair Australia if you need hands-on remote triage.
Why terminal forensics with ss matters on Australian Linux hosts
Unauthorized connections rarely announce themselves with a clear alert. More often you see elevated load, odd DNS lookups, failed logins, or a site that “works” while quietly phoning home. The classic netstat tool is deprecated on many distros; ss (from iproute2) is faster, more accurate, and already installed on modern Debian, Ubuntu, Rocky, Alma, and most cloud images.
Used correctly, ss answers: Who is listening? Who is established? Which process owns the socket? Is traffic IPv4, IPv6, TCP, or UDP? For remote delivery—the norm for Australian VPS and cloud boxes—you can run these checks over SSH without installing heavy agent suites first.
How do I use the Linux ss command to find unauthorized connections in Australia?
Run ss -tunap (or root-equivalent) to list TCP/UDP sockets with numeric addresses and process names, then filter for ESTABLISHED peers you do not recognise and LISTEN ports you did not open. Compare foreign addresses against expected APIs, CDNs, and backup endpoints; anything else is a candidate for kill, firewall block, and deeper process review. Australian operators on cloud VPS should treat unexpected outbound ESTABLISHED sessions and unknown listeners as incident signals, not noise.
| Symptom | Quick ss check | When to call Fixwebnode |
|---|---|---|
| Unknown remote IPs in ESTABLISHED state | ss -tunap state established | Cannot map PID, or traffic resumes after kill |
| Unexpected listening port | ss -tulnp | Listener owned by unknown binary or root kit path |
| Permission denied / empty process column | Re-run with sudo ss -tunap | Host compromise suspected; need remote forensics |
Common issues when hunting unauthorized connections with ss
These problems show up repeatedly on production Linux boxes used by small Australian businesses. Each has a different root cause—do not treat them as the same incident.
1. Established sessions to unfamiliar foreign addresses
Symptoms: ss shows ESTABLISHED TCP rows with remote IPs or hostnames you never configured (crypto pools, random VPS ranges, odd high ports). Outbound bandwidth or conntrack counts climb while the site still loads.
2. Unexpected services listening on public interfaces
Symptoms: Extra LISTEN entries on 0.0.0.0 or [::] for ports you did not open (for example 4444, 5555, 31337, or a second SSH on a non-standard port). Scanners may already be hitting them.
3. ss shows sockets but blank or “-” process fields
Symptoms: You run ss -tunap as a normal user and never see program names; or even as root, some sockets lack a PID. You cannot tell whether nginx, a reverse shell, or a deleted binary owns the connection.
4. Flood of TIME-WAIT / CLOSE-WAIT entries masking the real threat
Symptoms: Hundreds of TIME-WAIT rows after a traffic spike or app bug; operators miss the few ESTABLISHED or LISTEN lines that actually matter. CPU stays fine while forensic signal is buried.
How to fix each issue (DIY runbook)
Fix 1 — Investigate and contain unknown ESTABLISHED peers
Goal: list live peers, map process + binary, decide kill vs block, and preserve a short evidence snapshot.
Step 1 — Snapshot all TCP/UDP sockets with processes
sudo ss -tunap > /tmp/ss-full-$(date +%Y%m%d-%H%M%S).txt
sudo ss -tunap state established
sudo ss -o state established '( dport != :443 and dport != :80 and sport != :443 and sport != :80 )'Save the full dump before you kill anything. The filtered line surfaces non-web peers that often deserve first attention.
Step 2 — Resolve owners and inspect the binary path
sudo ss -tunap state established | awk 'NR>1 {print $0}'
# Replace <pid> with the PID inside users:(("name",pid=...))
sudo ls -l /proc/<pid>/exe
sudo tr '\0' ' ' < /proc/<pid>/cmdline; echo
sudo ls -l /proc/<pid>/cwd /proc/<pid>/fd 2>/dev/null | headLook for shells bound to sockets (bash, sh, python, perl, nc, ncat, socat), binaries under /tmp, /dev/shm, or home directories, and deleted executables ((deleted) in the exe link).
Step 3 — Correlate with firewall and recent auth
sudo journalctl -u ssh -S today --no-pager | tail -n 50
sudo grep -E 'Failed password|Accepted' /var/log/auth.log 2>/dev/null | tail -n 30
sudo iptables -L -n -v 2>/dev/null | head -n 40
sudo nft list ruleset 2>/dev/null | head -n 80Step 4 — Contain carefully
# Block one hostile remote (example IP — replace with yours)
sudo iptables -I INPUT -s 203.0.113.50 -j DROP
sudo iptables -I OUTPUT -d 203.0.113.50 -j DROP
# Or with nftables inet filter table if that is your stack
# Stop a clearly malicious PID only after you saved /tmp/ss-*.txt
sudo kill -9 <pid>Step 5 — Verify
sudo ss -tunap state established
curl -sI https://example.com | head -n 5Confirm the bad peer is gone and your legitimate site or API still responds. If the same remote reappears under a new PID within minutes, treat it as persistence—not a one-off process.
When to call Fixwebnode: the binary path is unfamiliar, the process respawns from cron/systemd user units, or you are unsure which ESTABLISHED peers are your payment gateway versus an implant. Remote specialists can take a structured dump and guide containment without wiping the only evidence.
Fix 2 — Find and shut unexpected listeners
Goal: inventory LISTEN sockets, prove what bound them, close or firewall what you did not authorize.
Step 1 — List listening TCP/UDP with process detail
sudo ss -tulnp
sudo ss -tulnp | grep -E ':(22|80|443|3306|5432|8080|25|587)\s'Build a mental allow-list: SSH, HTTP/HTTPS, database only on private interfaces, mail only if you actually run it.
Step 2 — Highlight anything outside your allow-list
sudo ss -tulnp | awk 'NR==1 || $1 ~ /tcp|udp/'
# Show only non-loopback listeners
sudo ss -tulnp | grep -v '127.0.0.1\|\[::1\]'Step 3 — Map service unit and package (when it is a real package)
sudo ls -l /proc/<pid>/exe
sudo systemctl status <pid> 2>/dev/null
# Many systems support:
sudo systemctl status $(ps -o unit= -p <pid> 2>/dev/null)
command -v dpkg >/dev/null && dpkg -S $(readlink -f /proc/<pid>/exe) 2>/dev/null
command -v rpm >/dev/null && rpm -qf $(readlink -f /proc/<pid>/exe) 2>/dev/nullStep 4 — Disable or bind correctly
# Example: stop an unknown listener you confirmed is not required
sudo systemctl disable --now <bad-service-name>
# Or kill orphan and remove its unit/cron after copying evidence
sudo kill -9 <pid>
# Tighten SSH example: listen only on a management address (edit after backup)
# then: sudo systemctl reload ssh || sudo systemctl reload sshdStep 5 — Verify public exposure
sudo ss -tulnp
# From another host or your laptop (replace host):
nc -vz YOUR_SERVER_IP 4444 || trueUnexpected public listeners should disappear from ss and fail remote connect tests.
When to call Fixwebnode: the listener binary is not owned by any package, reappears after reboot, or sits behind a web app you cannot take offline during business hours. We handle remote listener lockdown for operators across Australia—see where coverage is described on Fixwebnode service areas.
Fix 3 — Restore process visibility when ss hides PIDs
Goal: get reliable users:((...)) columns and handle namespaces or permission gaps.
Step 1 — Always elevate for forensics
ss -tunap | head
sudo ss -tunap | head
id; cat /proc/self/status | grep CapEffNon-root users often cannot read other users’ socket inodes—blank program fields are usually permissions, not “no process.”
Step 2 — Query by port when the table is noisy
sudo ss -tunap '( sport = :443 or dport = :443 )'
sudo ss -tunap sport = :22
sudo ss -ltnp 'sport = :8080'Step 3 — Cross-check with lsof and /proc if ss still omits the name
sudo lsof -nP -iTCP -sTCP:ESTABLISHED
sudo lsof -nP -iTCP -sTCP:LISTEN
sudo ls /proc/net/tcp /proc/net/tcp6Step 4 — Watch for container or chroot mismatch
ps -ef | grep -E 'docker|containerd|podman' | grep -v grep
sudo ss -tunap | grep -E 'docker-proxy|conmon'
# Inside a host namespace view you may need:
sudo nsenter -t <container-pid> -n ss -tunapIf the connection lives inside a container network namespace, host-level ss may show docker-proxy while the real app socket is elsewhere.
Step 5 — Verify
sudo ss -tunap | grep -v users: || echo "Still missing process tags — escalate"
sudo ss -tunap | grep users: | headWhen to call Fixwebnode: elevated ss still cannot map sockets, you suspect hidden namespaces or rootkit interference, or lsof and ss disagree wildly. That is beyond casual DIY.
Fix 4 — Cut through TIME-WAIT noise without missing real threats
Goal: summarise by state, then focus human attention on ESTABLISHED and LISTEN only.
Step 1 — Count sockets by state
sudo ss -tan | awk 'NR>1 {print $1}' | sort | uniq -c | sort -nr
sudo ss -sStep 2 — Explicitly exclude terminal states from the working view
sudo ss -tunap state connected
sudo ss -tunap state established
sudo ss -tlnpStep 3 — If CLOSE-WAIT dominates, find the stuck application
sudo ss -tunap state close-wait
sudo ss -tunap state close-wait | awk -F'pid=' 'NF>1{split($2,a,","); print a[1]}' | sort | uniq -c | sort -nrHigh CLOSE-WAIT usually means your app is not reading/closing sockets—not necessarily an attacker—but malware can hide in the same table, so still map top PIDs.
Step 4 — Optional sysctl hygiene (do not use as a substitute for killing malware)
sysctl net.ipv4.tcp_fin_timeout net.ipv4.tcp_tw_reuse 2>/dev/null
# Only change tunables you understand and can roll back; document previous values first.Step 5 — Verify signal-to-noise
sudo ss -tunap state established
sudo ss -tlnpYou should be able to read every remaining line without scrolling past hundreds of TIME-WAIT clones.
When to call Fixwebnode: state tables are huge, the host is a busy e-commerce node you cannot restart lightly, or you need help separating application bugs from active intrusion while staying online.
When DIY is enough vs when to book Fixwebnode
DIY is enough when you can map every unexpected socket to a known package, kill or disable it, confirm it does not return after a controlled restart of the related service, and your allow-listed listeners match the business (SSH, web, database on private interfaces only). Keep the /tmp/ss-*.txt snapshots for a week.
Book Fixwebnode when any of the following are true: processes respawn from unknown systemd user units or cron; executables live under /tmp or show (deleted); outbound peers return after IP blocks; you manage customer data and need a clean remote incident pass; or you simply need a second pair of expert eyes on a production host during Australian business hours. Fixwebnode is a direct specialist provider for remote terminal forensics and related web/server repair—not a freelance marketplace—so you speak with the people doing the work.
Remote sessions typically start from the same ss baseline in this article, then move into process tree review, persistence checks, and listener hardening. Soft scheduling only: early bookings are often handled the same day when capacity allows.
Book remote help for ss-based connection forensics
Unauthorized sockets are a clarity problem first and a malware problem second. With ss, you can see listeners and peers in seconds, map them to PIDs, and either finish the job yourself or hand a clean evidence trail to a specialist.
If you want guided remote triage for a Linux VPS or on-prem host in Australia—sole trader, home lab serving a business site, or small company server—start a conversation through the landing page: Fixwebnode website repair Australia. Bring your latest ss -tunap output if you already ran the steps above; that shortens time-to-containment.