Linux - Secure ssh, Mail alerts when someone logs into your SSH

Secure ssh

Mail alerts when someone logs into your SSH

You can make your ssh or shell secure by alerting yourself when someone login to your ssh. Just add any one of the shell script in your profile.

Find Profile in your home directory
vi /root/.bash_profile

Script to secure SSH

echo 'ALERT - Root Shell Access (YourserverName) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d"(" -f2 | cut -d")" -f1`" you@yourdomain.com

or

echo 'ALERT - Root Shell Access on:' `date` `who` | mail -s "Alert: Root Access from `who | awk '{print $6}'`" mailid@mail.com

Make sure that the e-mail address you use is not hosted on the server.

The above scripts will alert you when someone enters into your ssh. This is a simple tip to secure your ssh.

The topic on Linux - Secure ssh is posted by - Venki

Hope you have enjoyed, Linux - Secure sshThanks for your time

Tech Bluff