1. edit file .bashrc
#vim /root/.bashrc
--------------------------------------Start-----------------------------------------------
Type: 1
echo 'ALERT - Root Shell Access (mail.mydomain.co.th) on:' `date` `who` | mail -s "Alert: Root Access to MAIL server mycompany from `who | cut -d"(" -f2 | cut -d")" -f1`" email@domain.co.th
Type: 2
sh /root/checklogin/.shell-login.sh | mail -s "Alert Root Access to Server from: `who | cut -d"(" -f2 | cut -d")" -f1`" email@domain.co.th
Type:3 [send pass SMPT, By sender]
sh /root/checklogin/.shell-login.sh | mail -S smtp:192.168.0.xx:25 -s "Alert Root Access to Server from: `who | cut -d"(" -f2 | cut -d")" -f1`" -r sender@domain.co.th -v receive@domain.co.th
---------------------------------------End-----------------------------------------------
2. create file on /root/.shell-login.sh
-----------------------------/root/.shell-login.sh-------------------------------------------
#!/bin/bash
echo "Login on: $(hostname) (at) $(date)"
echo "Change user to: "$(whoami)
echo
w -i
------------------------------End------------------------------------------------------
-----------------------------/root/.shell-login.sh-------------------------------------------
#!/bin/bash
echo "Login on: $(hostname) (at) $(date)"
echo "Change user to: "$(whoami)
echo
w -i
------------------------------End------------------------------------------------------
No comments:
Post a Comment