Email Alert for SSH login
Step 1
Please ensure your sendmail SMTP service is running that it can use the command 'mail'
[root@local~]# cd /usr/local/bin
[root@local~]# wget http://linux.alanstudio.hk/ssh_email_alert.sh
[root@local~]# chmod 755 /usr/local/bin/ssh_email_alert.sh
[root@local~]# vi /usr/local/bin/ssh_email_alert.sh
name@domain.com
Download my script to /usr/loca/bin and edit the file to change the alert email address.
Step 2
[root@local~]# vi /etc/bashrc
## Email Alert for All User SSH login
/usr/local/bin/ssh_email_alert.sh
Add the sh mand in the end of file of /etc/bashrc for all user's ssh login
OR
[root@local~]# vi /root/.bash_profile
## Email Alert for Root SSH login
/usr/local/bin/ssh_email_alert.sh
Add the sh command in the end of file of /root/.bash_profile for root ssh login only
Server is hosted by Alanstudio
Linux Operating System
Recommend screen resolution 1024 x 768 / IE / FireFox
Alan Studio © 2007 by Alan Cheung Hin Lun. All rights reserved.
|