Mail on SSH-login

First we need a way to send an e-mail. This package provides the "mail" command.

apt-get install mailutils

As root, create the file /etc/ssh/sshrc with the following content:

exec 1>&2
env | mail -s "LOGIN $USER@$(hostname) from ${SSH_CONNECTION%% *}" root

From now on the user "root" will receive …

more ...