Mail notifications for sudo shows syntax error


 
Thread Tools Search this Thread
Homework and Emergencies Emergency UNIX and Linux Support Mail notifications for sudo shows syntax error
# 1  
Old 05-26-2014
Linux Mail notifications for sudo shows syntax error

Im Using Centos Version

Code:
[sysadmin@li406-64 ~]$ cat /etc/redhat-release 
CentOS release 6.4 (Final)

I'm Using Sudo Version

Code:
[sysadmin@backup-srv ~]$ sudo -V
Sudo version 1.8.6p3
Sudoers policy plugin version 1.8.6p3
Sudoers file grammar version 42
Sudoers I/O plugin version 1.8.6p3

tried to setup notification mail for sudo, added this entry in bottom of sudo file using command visudo, But getting syntax error

Code:
Defaults	mailto "babin@xxxxxxxxx.com"
Defaults	mailfrom "root@media.xxxxxxxxxxx.com
Defaults	mail_always on
Defaults	mailsub “*** Command run via sudo on %h ***”
Defaults	mail_badpass on
Defaults	badpass_message "Please Provide Correct Password"
Defaults	!lecture,tty_tickets,!fqdn,!syslog
Defaults	logfile=/var/log/sudo.log

This what the error im keep on getting while saving the sudo


Code:
 121 Defaults        mailto "babin@xxxxxxxxx.com"
    122 Defaults        mailfrom "root@media.xxxxxxxxxxx.com
    123 Defaults        mail_always on
    124 Defaults        mailsub “*** Command run via sudo on %h ***”
    125 Defaults        mail_badpass on
    126 Defaults        badpass_message "Please Provide Correct Password"
    127 Defaults        !lecture,tty_tickets,!fqdn,!syslog
    128 Defaults        logfile=/var/log/sudo.log


Error:

Code:
visudo: >>> /etc/sudoers: syntax error near line 121 <<<
visudo: >>> /etc/sudoers: syntax error near line 121 <<<
What now?

Please guide me how to setup the mail notification for Sudo version 1.8.6p3
# 2  
Old 05-26-2014
I think, you need an equal sign in the statements
Code:
Defaults    mailfrom = "root@media.xxxxxxxxxxx.com"
Defaults    mail_always
Defaults    mailsub = "*** Command run via sudo on %h ***"
Defaults    mail_badpass
Defaults    badpass_message = "Please Provide Correct Password"
Defaults    !lecture,tty_tickets,!fqdn,!syslog
Defaults    logfile=/var/log/sudo.log

... and mail_always and mail_badpass do not take arguments.
This User Gave Thanks to hergp For This Post:
# 3  
Old 05-26-2014
Its Worked Perfectly as your Guide

Quote:
Originally Posted by hergp
I think, you need an equal sign in the statements
Code:
Defaults    mailfrom = "root@media.xxxxxxxxxxx.com"
Defaults    mail_always
Defaults    mailsub = "*** Command run via sudo on %h ***"
Defaults    mail_badpass
Defaults    badpass_message = "Please Provide Correct Password"
Defaults    !lecture,tty_tickets,!fqdn,!syslog
Defaults    logfile=/var/log/sudo.log

... and mail_always and mail_badpass do not take arguments.
That's Worked for me Perfectly, Thanks Sir.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Email Notifications on Cron Bash Error Only cp mv rsync

Wondering if anyone can point me to an example of how to setup a bash script that executes cp mv and rsync commands and only sends an email if there were errors with any of those commands and what the errors are. In addition it should email if the cron event to execute the script fails, or in... (1 Reply)
Discussion started by: consultant
1 Replies

2. UNIX for Advanced & Expert Users

Sudo syntax

Anyone know of a way shorten a Cmnd_Alias when multiple similar commands are used? For example, I need to grant access to /usr/bin/systemctl start <service>, /usr/bin/systemctl stop <service>, /usr/bin/systemctl restart <service>, and /usr/bin/systemctl status <service>. I think there is a way to... (1 Reply)
Discussion started by: ducet8
1 Replies

3. Solaris

SUDO error in Solaris: auth.error] fork

I cannot solve the following error bellow. Can someone help me on this please? Mar 31 07:08:45 serverx sudo: fork Mar 31 07:18:50 serverx sudo: fork Mar 31 07:28:45 serverx sudo: fork Mar 31 07:38:47 serverx sudo: fork Mar 31 07:48:45 serverx sudo: fork Mar 31 07:58:45 serverx... (1 Reply)
Discussion started by: pangarano
1 Replies

4. Shell Programming and Scripting

Sending an email with mail function shows up as an attachment 'noname'

I have a file named email.html with this as the contents: Content-type: text/html ACHI,ACCRETIVE HEALTH ,7.15,<br>CPRT,Copart Inc.,36.14,<br>GEOB.MX,GEO-B,1.660,<br>GCO,Genesco Inc. Comm,73.58,<br>GMAN,Gordmans Stores, ,<br>GES,Guess? Inc. Comm,26.45,<br>KBR,KBR Inc. Common... (1 Reply)
Discussion started by: phpchick
1 Replies

5. Solaris

Unauthorized sudo access mail

We want to get a notification for all unauthorized sudo access via e-mail to our team DL .. whats the way to do it ? (1 Reply)
Discussion started by: fugitive
1 Replies

6. Shell Programming and Scripting

file system status mail notifications

HI I want to get an e-mail @ my yahoo address when the file system used space gets more than 89% , & the message contents must be the outputs of df -g errpt netstat -i ??????? (3 Replies)
Discussion started by: majd_ece
3 Replies

7. Solaris

SFTP is successful but still shows timeout error

Hi, I am doing sftp from remote server1 to remote server2. This is done through a script. This script was working fine. But if i am tranfer files of 120 MB only some part of the file gets transferred (around 9 MB). Incase i put the same file manually it gets uploaded successfully. Can... (1 Reply)
Discussion started by: subiksha
1 Replies

8. UNIX for Dummies Questions & Answers

multiplication shows syntax error

my shell script is simple arithmetic process.my addtion,substract and divide all can be worked only except multiplication.please help me.the shell is following: #!/usr/bin/sh echo "enter a number1:" read number1 echo "enter an operator:" read operator echo "enter a number2:" read number2... (4 Replies)
Discussion started by: sonicstage
4 Replies

9. Solaris

Solaris E-Mail Notifications ?!

Hi , I need to have a monitoring system also I wanna have E-Mail Notification .or SMS notification to be on touch with my System : ) ... Regards Adel (1 Reply)
Discussion started by: ArabOracle.com
1 Replies
Login or Register to Ask a Question