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 the CSF firewall is enabled on the server.

Step 2. Check the 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 [email protected]:
LF_ALERT_TO = "[email protected]"

Step 4. Restart firewall.
csf -r

Alternatively, make sure the following parameter is enabled in CSF:
LF_CPANEL_ALERT = "1"

You can then go ahead and add the 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`" [email protected]

Replace [email protected] with your email address.

That's it!

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Domain names are not showing in WHM

We were unable to see any domains listed under WHM -> List Accounts. However, we can see the...

How to Start/Stop or Restart Apache server

Apache is the HTTP server that is freely available over the internet. It is a kind of software or...

How to install Attracta SEO Tools plugin

RequirementscPanel/WHM needs to be installed on your server. Step 1: SSH into your server and go...

How to Install CpCleaner in cPanel through SSH?

Installation Run the following shell commands as root via SSH: wget -O cpc-1.0.3.tar...

How to Secure a cPanel/WHM Web Server

Here are a few basic steps that you should keep in mind for keeping a server secure. 1) Strong...