Skip to content

Instantly share code, notes, and snippets.

@dzhurinskij
Last active August 1, 2025 01:09
Show Gist options
  • Save dzhurinskij/17eb0405f54db0cb29bcf5c58e936d9f to your computer and use it in GitHub Desktop.
Save dzhurinskij/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