Last active
July 7, 2022 14:03
-
-
Save shmick/7d635a8579647a789d7ffdfcc9d09506 to your computer and use it in GitHub Desktop.
A quick and dirty script to kill off stale ssh sessions on an asus router
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# add to cron to run every 20 minutes | |
# cru a ssh-clean "1,21,41 * * * * /jffs/cron/ssh-clean" | |
# remove cron | |
# cru d ssh-clean | |
netstat -p | grep ":ssh.*192.168.118.10:.*ESTABLISHED" | awk '{print $7}' | awk -F'/' '{print "kill", $1}' | sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment