Set up email notification for any users whenever they try to access Sudo privileges. By adding few configuration changes in Sudo entry we can get notified through email.

Edit the sudoer file using visudo

# visudo

Enabled the sudo user and enter the following entry in bottom of the file

Defaults mailto = “alertforxxxxxx@gmail.com”
Defaults mailfrom = “root@xxxxxxx.com”
Defaults mail_badpass
Defaults mail_always
Defaults mail_no_user
Defaults mailsub = “*** Command run via sudo on %h ***”
Defaults badpass_message = “Please Provide Correct Password”
Defaults !lecture,tty_tickets,!fqdn,!syslog
Defaults logfile=/var/log/sudo.log

This will send email’s while some user’s use sudo command.

Babin Lonston
Overall 13+ Years of experience in IT field, 7+ years of experience in Linux administration with Virtualization & Cloud technologies. Love documentation and being Numismatics for a long time.

Installing Monit in Ubuntu Servers

Previous article

Creating swap space using a file in Linux

Next article

You may also like

Comments

Leave a reply

Your email address will not be published.

More in Linux