Um bei einem Root Login ein E-Mail Alert zu bekommen muss man folgendes einstellen:
1. E-mail dienst auf dem Server aktivieren
2. /root/.bashrc anpassen
(1) Email Server
apt-get install postfix
General type of mail configuration: <— Internet Site
System mail name: <— server1.example.com
Root and postmaster mail recipient: <— [blank]
Other destinations to accept mail for (blank for none): <— server1.example.com, localhost.example.com, localhost.localdomain, локальный
Force synchronous updates on mail queue? <— No
Local networks: <— 127.0.0.0/8 [::FFFF:127.0.0.0]/104 [::1]/128
Use procmail for local delivery? <— Yes
Mailbox size limit (bytes): <— 0
Local address extension character: <— +
Internet protocols to use: <— all
(2) /root/.bashrc
man öffnet mit einem editor /root/.bashrc und fügt folgende Zeile ein
echo ‘ALERT — Root Shell Access («servername») on:’
date
who
| почта -s «Alert: «servername»- Root Access fromwho | cut -d"(" -f2 | cut -d")" -f1
» «E-Mail Adresse»
Dann muss man das ganze speichern und man bekommt bei jedem root / sudo login eine E-Mail