Who owns that port? One ss flag answers it without sudo

Who owns that port? One ss flag answers it without sudo

●1 ●21 ●82
calendar_today • schedule1 min read

Who owns that port? One ss flag answers it without sudo

For months my dev server started on 3001 because something already held 3000, and I kept stepping around it. When I finally asked, ss -ltn 'sport = :3000' showed the port listening on every interface — with an empty Process column, because ss -p only names sockets owned by your own user. Without root, it looked like nobody owned it.

One flag closes most of that gap:

ss -ltnpe 'sport = :3000'

-e prints the socket's cgroup, and on a systemd machine the end of that path is the unit that opened it. Mine ended in docker.service. docker ps then named it: a docker-proxy publishing a container I had started in the spring and forgotten, reachable from the whole network.

Two things worth carrying away. The host only ever sees Docker's proxy, never the application behind it, so a host-side port list tells you what is exposed, not what is running. And "list open ports" is really three questions: what is listening, who owns it, and whether it is reachable. They need three different commands.

The full write-up covers all three — with and without root, without netstat, inside containers, and an audit script that diffs the listener list between runs: how to list open ports on Linux with the owning process.

2 Comments

1 vote
0
🔥 Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.

More Posts

My 30-day log cleanup kept a file that was 30 and a half days old

BashSnippets - Oct 8

sed 's/port/listen_port/g' rewrote four lines of a four-line config

BashSnippets - Oct 1

bash ran a path that no longer existed, and exited 127

BashSnippets - Oct 21

ShellCheck rates SC2086 as info. It let rm delete two files I never named.

BashSnippets - Sep 29

I escaped the dot correctly and sed still rewrote a file marked DO NOT CHANGE

BashSnippets - Oct 13
chevron_left
3.8k Points • 104 Badges
North America • bashsnippets.xyz
68Posts
31Comments
10Connections
Linux user who got tired of Googling the same bash commands every time I sat down at a terminal. Sta... Show more

Related Jobs

View all jobs →

Commenters (This Week)

2 comments
2 comments
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!