Skip to content

Instantly share code, notes, and snippets.

@adzhurinskij
Last active December 7, 2023 05:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • 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 <adzhurinskij@gmail.com>
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