I'd like to, as the administrator of an OpenBSD ssh jumphost used by multiple people, run a specific command any time any user connects via SSH, even if just for tunneling.
Is this possible?
I've tried using
/etc/sshrc but these seem only to apply when the user has an interactive session and not otherwise.
Because I'm running OpenBSD, nothing PAM-based will work unfortunately, i.e. This answer on Unix & Linux
The script just runs
sendmail using the
$SSH_CONNECTION to inform me of who logged in and from where.
#!/bin/sh EMAILfirstname.lastname@example.org sendmail -F alerts -f $EMAIL root << EOF Subject: New Login For $1 Message-ID: <$(date +%s)@$(hostname)> X-Mailer: OpenSMTPD Content-Type: text/plain There has been a new login for $1 on $SSH_CONNECTION EOF