Last active
July 28, 2024 19:48
-
-
Save adzhurinskij/17eb0405f54db0cb29bcf5c58e936d9f to your computer and use it in GitHub Desktop.
/etc/ssh/sshrc example
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/bash | |
ip=`echo $SSH_CONNECTION | cut -d " " -f 1` | |
hostname=`hostname` | |
fqdn=`hostname -f` | |
logger -t ssh-wrapper $USER login from $ip | |
sendmail -t <<EOF | |
To: Alex <[email protected]> | |
From: ${hostname} <no-reply@${fqdn}> | |
Subject: SSH Login $USER from $ip | |
User $USER just logged in from $ip | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice and quite handy. Thanks!