summaryrefslogtreecommitdiff
path: root/debian/systemd/ssh-session-cleanup
blob: f283cc96707852df541f446d2f9ca1fe8cae86ef (plain)
1
2
3
4
5
6
7
8
9
10
11
#! /bin/sh

ssh_session_pattern='sshd: \S.*@pts/[0-9]+'

IFS="$IFS@"
pgrep -a -f "$ssh_session_pattern" | while read pid daemon user pty; do
	echo "Found ${daemon%:} session $pid on $pty; sending SIGTERM"
	kill "$pid" || true
done

exit 0