Unix & Linux Asked on December 8, 2021
I have a system that runs multiple sshd daemons. Each daemon listens to a separate port.
How can I terminate all sessions started by a specific daemon without affecting other ssh sessions?
if you have the pid of the sshd,
pkill --parent pid
should send SIGTERM to all children of the sshd
maybe add --signal kill
if you want to force-kill them
Answered by hanshenrik on December 8, 2021
Run this to find out which PIDs you're interested in.
netstat -n -eep | grep port_number
Run any of these commands to see the interesting processes children and terminate them:
ps fax
# or
pstree -p
Answered by Artem S. Tashkinov on December 8, 2021
If you know the ssh port, you can simply kill all current tcp sessions that were initiated through it:
ss -K dport 22
This kills all active ssh sessions that were started through port 22 while leaving other ssh sessions intact. Don't forget to stop the sshd
daemon before you kill off its sessions.
Answered by Tenders McChiken on December 8, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP