• Welcome to Web Hosting Community Forum for Webmasters - Web hosting Forum.
 

Recommended Providers

Fully Managed WordPress Hosting
lc_banner_leadgen_3
Fully Managed WordPress Hosting

WordPress Theme

Divi WordPress Theme
WPZOOM

Forum Membership

Forum Membership

E-mail Alert on Root SSH Login

Started by Kevin, November 26, 2008, 10:35:22 AM

Kevin

It is essential that you have been notified whenever someone login to your server. On the server, you can set an email alert when someone login to your server as root.

[1] Login to your server as a root user.

[2] Type the below command:
pico /root/.bashrc

[3] Scroll down to the end of the file and add the following line:

echo 'Root Shell Access on your [ServerName] on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d"(" -f2 | cut -d")" -f1`" <a href="mailto:[email protected]">[email protected]</a>

[4] Save the file and exit from SSH. Now login to your server and check whether you are receiving the email alert or not.

Regards,

Kevin