Olá, gostaria de saber se existe alguma forma de receber um alerta(email, mensagem ou notificação) no meu smartphone toda vez que alguém fizer login no meu sistema.
Uso o PopOs-20.04 LTS
Modify or create /etc/ssh/sshrc
with the following contents:
ip=`echo $SSH_CONNECTION | cut -d " " -f 1`
logger -t ssh-wrapper $USER login from $ip
echo "User $USER just logged in from $ip" | sendemail -q -u "SSH Login" -f "Originator <[email protected]>" -t "Your Name <[email protected]>" -s smtp.server.com &
This will effectively notify you by email anytime someone logs in through SSH, and the login will be logged in the syslog.
Note: You’ll need the sendemail
package (sudo apt-get install sendemail
) for the email notification to work.
Note: works with port forwarding, but with -N option not.