News for hackers. Stuff that matters.
Re:A command-line tool to easily kill processes running on a... by klysm on Tuesday April 25, 2023 @07:28AM (#35698968)
When would you have multiple pids?
Re:A command-line tool to easily kill processes running on a... by TheDong on Tuesday April 25, 2023 @07:36AM (#35699044)
See SO_REUSEPORT in 'man 7 socket'

If, for example, you run nginx in a default configuration, you'll notice both the master and worker processes will have an fd bound to the same port (port 80 or whatever), so it's also not exactly unusual.

Even without SO_REUSEPORT, you can have multiple things on one port if you have multiple IPs, like something listening on "127.0.0.1:80", and a different process listening on "192.168.1.10:80"

Re:A command-line tool to easily kill processes running on a... by klysm on Tuesday April 25, 2023 @11:02AM (#35701435)
So if you had one process listening to the same port on multiple ips, this xargs would fail on the second invocation? Seems like piping through uniq may be a good idea
Re:A command-line tool to easily kill processes running on a... by andylynch on Tuesday April 25, 2023 @07:42AM (#35699102)
Probably when binding a socket with SO_REUSEADDR or SO_REUSEPORT.
Re:A command-line tool to easily kill processes running on a... by whackx on Tuesday April 25, 2023 @07:51AM (#35699188)
sshd does this.

sshd 3891262 root 4u IPv4 15450342 0t0 TCP ibpmaas-testing:https->10.10.47.11:49064 (ESTABLISHED)

sshd 3891351 ubuntu 4u IPv4 15450342 0t0 TCP ibpmaas-testing:https->10.10.47.11:49064 (ESTABLISHED)

# lsof -ti ":49064"

3891262 3891351

edit for readability