1828667 Members
1403 Online
109984 Solutions
New Discussion

Re: visudo

 
SOLVED
Go to solution
Maaz
Valued Contributor

visudo

Hello Gurus

#visudo
.
.
.
Cmnd_Alias restart=/sbin/shutdown -r 0 #***line 26
username ALL=restart #*** line 27

>>> sudoers file: syntax error, line 26 <<<
>>> sudoers file: syntax error, line 27 <<<
What now?

"Cmnd_Alias" is the cause of this error, bcause when i remove this line, all other things work fine.
plz let me know the correct synatx of Cmnd_Alias

Regards
Maaz
5 REPLIES 5
Rick Garland
Honored Contributor

Re: visudo

Could be a line abouve line 26 causing the problem. It is just spitting out the errors when it gets to line 26.

Comment out lines 26 & 27, are you still getting errors?

Maaz
Valued Contributor

Re: visudo

Thanks for reply Rick Garland
i have attached the /etc/sudoers file. plz check it.

Thanks
Maaz
Sergejs Svitnevs
Honored Contributor
Solution

Re: visudo

Please change
"Cmnd_Alias restart=/sbin/shutdown -r 0"
to
"Cmnd_Alias RESTART=/sbin/shutdown -r 0"

Regards,
Sergejs
Gopi Sekar
Honored Contributor

Re: visudo


Cmnd_Alias variable should be uppercase letter, so the correct syntax is Cmnd_Alias RESTART=/sbin/shutdown -r 0

here is the snip from man page of sudoers
Each alias definition is of the form


Alias_Type NAME = item1, item2, ...

where Alias_Type is one of User_Alias, Runas_Alias, Host_Alias, or Cmnd_Alias. A NAME is a string of uppercase letters, numbers, and underscore characters (â _â ). A NAME must start with an uppercase letter. It is possible to put several alias definitions of the same type on a single line, joined by a colon (â :â ). E.g.,

Alias_Type NAME = item1, item2, item3 : NAME = item4, item5



for more information check man sudoers

R
Never Never Never Giveup
Maaz
Valued Contributor

Re: visudo

Thanks Dear Sergejs Svitnevs, and Gopi Sekar, the help/reply.

Thanks to All
Regards
Maaz