summaryrefslogtreecommitdiff
path: root/debian/systemd/ssh-session-cleanup
diff options
context:
space:
mode:
Diffstat (limited to 'debian/systemd/ssh-session-cleanup')
-rwxr-xr-xdebian/systemd/ssh-session-cleanup11
1 files changed, 11 insertions, 0 deletions
diff --git a/debian/systemd/ssh-session-cleanup b/debian/systemd/ssh-session-cleanup
new file mode 100755
index 000000000..f283cc967
--- /dev/null
+++ b/debian/systemd/ssh-session-cleanup
@@ -0,0 +1,11 @@
1#! /bin/sh
2
3ssh_session_pattern='sshd: \S.*@pts/[0-9]+'
4
5IFS="$IFS@"
6pgrep -a -f "$ssh_session_pattern" | while read pid daemon user pty; do
7 echo "Found ${daemon%:} session $pid on $pty; sending SIGTERM"
8 kill "$pid" || true
9done
10
11exit 0