Skip to content

Instantly share code, notes, and snippets.

@adzhurinskij
Last active July 28, 2024 19:48
Show Gist options
  • Save adzhurinskij/17eb0405f54db0cb29bcf5c58e936d9f to your computer and use it in GitHub Desktop.
Save adzhurinskij/17eb0405f54db0cb29bcf5c58e936d9f to your computer and use it in GitHub Desktop.
/etc/ssh/sshrc example
#!/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
@etkopa
Copy link

etkopa commented Jul 28, 2024

Nice and quite handy. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment