-   Linux - General (
-   -   Syntax error in sudoers file (

Julix 09-02-2007 07:05 PM

Syntax error in sudoers file
Hi Everybody,

I recently moved to Slackware 12 and noticed that the sudo logs are send to the mailbox of root, for example if a user tries to use SUDO and is not defined in the SUDOERS file, an incident report is send to root. I would like to change that the this kind of mails goes to my user account just to avoid using root as least as possible. I have tried to put the something like DEFAULT MAILTO = "me@host" but I keep getting syntax error. Does anyone know how set it correctly?

Thanks and regards,


anomie 09-02-2007 07:23 PM

I suppose it's possible you have a somewhat different sudo implementation/version (?), but on my CentOS 4 box, man 5 sudoers shows:

Address to send warning and error mail to. The address
should be enclosed in double quotes (") to protect against
sudo interpreting the @ sign. Defaults to root.
I haven't tested this, but I'd interpret that to mean:
mailto = "some@email.address"

Good idea editing with visudo, by the way. A syntax error at save/parse time is a lot better than a broken sudo. ;)

------------ edit ----------------------------------------

Ok, I was wrong. But this passes the syntax check:
Defaults mailto = "some@email.address"

I haven't tested the actual functionality. Hopefully that'll be the one.

Tinkster 09-02-2007 07:33 PM

Have you tried without the word default? What exactly does your line
look like?


Julix 09-02-2007 08:27 PM

Thanks all for your replies,

My user account is julix, and the hostname is jtlx
actually the line look exactly like this:

default mailto = "julix@jtlx"

i have tried it without "default" :

mailto = "julix@jtlx"

,but I still get the syntax error message



anomie 09-02-2007 09:17 PM

Neither of those passes my syntax checker. Try the second suggestion I mentioned above.

Julix 09-02-2007 10:35 PM

I have entered the line

Defaults mailto = "julix@jtlx" and it passed the syntax on the sudoers file,I had to put the d in upper case. STUPID ME!!!!:D But when I test with another user account who is not on the sudoers file to execute as SUDO, the system does not send the mail with the incident report to my account julix nor to the root. I have looked in the man page and add the parameter mail_no_user. The line would be look like this Defaults mail_no_user mailto = "julix@jtlx but then I get the syntax error again .
Anomie, my apologies if I am wrong but I think you are saying to try something like example Default mailto ="", well what I want is that the reports donīt go to some email address but to my account mail within my linuxbox.



anomie 09-03-2007 08:56 PM

One more comment from me, and if it doesn't work I may have to do some real testing. :eek:

Have you tried simply:
Defaults mailto = "julix"


Julix 09-05-2007 10:35 AM

I have tried the Defaults mailto= "julix" entry, it passes the syntax verification but it wonīt send the notification to my account. Maye I have to add some additional parameters

Julix 09-07-2007 05:18 PM

Found the problem!!!
When I setup Slackware in my box, I didnīt enable the sendmail daemon. I have enabled it now and the issue has been solved.


Tinkster 09-07-2007 09:44 PM

Oh dear :}

Well, glad you found the solution in the end ;}


All times are GMT -5. The time now is 09:34 PM.