I'm trying to execute a bash file whenever there's a failed attempted login via SSH onto my Ubuntu server.
Can anyone suggest how to do this?
As an aside, I'm currently running a script on a successful logon using the /etc/pam.d/sshd file. I'd like to do the same for unsuccessful logons.
session optional pam_exec.so /usr/bin/my-script.sh