SSH Root User Login Notification

SSH Root User Login Notification

Hello There

 

Sometime you need to set SSH root user login notification who is login into your system. Its very easy just make one line command or script & put this into /root/.bashrc file.

Step1: Open terminal & first test this command on terminal.

root@host1:~# echo ALERT - Root Shell Access $HOSTNAME on: `date` `who` | mail -a "From: No-Reply <reply@yourdomain.com>" -s "Alert: Root SSH Acess" admin@yourdomain.com
root@host1:~#

If you got no error & received email notification on your mentioned email ID then put this command into /root/.bashrc file.

 Step2: Open terminal & save this command into /root/.bashrc.

root@host1:~# vim /root/.bashrc

Paste above command at end of the file & save file.

echo ALERT - Root Shell Access $HOSTNAME on: `date` `who` | mail -a "From: No-Reply <reply@yourdomain.com>" -s "Alert: Root SSH Acess" admin@yourdomain.com
root@host1:~#

Now login again by ssh root user I am sure you will get email notification.

{#moods_dlg.WellDone}

 

Leave a Reply

Time limit is exhausted. Please reload the CAPTCHA.