As SysAdmin maintaining server security is our first important task. Whenever we launch a new server for production. We have to make sure the security on the server is not compromised. Because if someone enters server as root user using bruce attack techniques then think how he will damage your server. Anyone who has root access can do anything on the server.
To make SSH Secure, we will set up an Email alert on the server. so we will get an alert if someone trying to login on the server using SSH.
Follow below link to another SSH article for securing the SSH login.
Always make a practice to not directly login with root user via SSH. If you want to access server first login with the normal user then use su to switch in root user.
In this article, we will look simple way to know when someone tries to log in as the root user. It will provide or send an email alert ssh login notification to the mentioned email ids with IP of the last login.
Let's see the configuration steps to get Email alert ssh login on a Linux server.
To make this setting on the server you must have root level access on the server.