How to enable root login alerts on cPanel server?

For security reasons, you would like to get an alert to your mailbox if someone logins to the server with root credentials.

Step 1. Make sure csf firewall is enabled on the server.

Step 2. Check CSF configuration file .

Make sure below values are set to 1 - 
LF_SSH_EMAIL_ALERT = "1"

step 3. Add your email address on which you would like to receive an email your@yourdomain.com -
LF_ALERT_TO = "your@yourdomain.com"

Step 4. Restart firewall.
csf -r

Alternatively, make sure following parameter is enabled in csf -
LF_CPANEL_ALERT = "1"

You can then go ahead an add following code to bashrc file -

cd /root
nano .bashrc
echo 'ALERT - Root Shell Access (ServerName) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d'(' -f2 | cut -d')' -f1`" your@yourdomain.com

Replace your@yourdomain.com with your email address.

That's it!

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to reset SSH port back to default port 22?

In some situations most of us may come across a problem that we are able to log into the WHM but...

How to setup the root login alert notification email?

Its very important to keep a check on your servers and who logs into the server, From security...

How to enable Open SSL on WHM?

Before enabling open SSL, you can check whether it is already enabled on your server. Please fire...

How to install mod_pagespeed on WHM?

'mod_pagespeed' is module of Apache which is nothing but plugin which is used for compressing the...

How to enable Hot Link Protection in cPanel?

To avoid other sites to use your website's bandwidth, you can enable the hot link protection....

Powered by WHMCompleteSolution