1. Login to the server via SSH using as root ID.
2. Ensure that you’re at home directory of root. The open up the .bashrc for editing using pico or vi by typing one of the following commands at command shell line:
Now log out and login again as root, you should receive an email alert at your inbox.
2. Ensure that you’re at home directory of root. The open up the .bashrc for editing using pico or vi by typing one of the following commands at command shell line:
vi .bashrc3. Scroll down to the end of the file and add the following line:
echo ‘ALERT – Root Shell Access on:’ `date` `who` | mail -s “Alert: Root Access from `who | cut -d”(” -f2 | cut -d”)” -f1`” user@example.comReplace user@example.com with the actual email account address that you want to the root access alert notification been sent to. Note that you can even change the text content in the email alert. The text starting with first ALERT is written as email body, and you can add in other info such as host name or change the wordings. The second Alert is the email body.
Now log out and login again as root, you should receive an email alert at your inbox.
No comments:
Post a Comment