sudo

E. J. Cerejo edinho64 at netscape.net
Thu Apr 10 11:38:21 PDT 2003



ms at probsd.org wrote:
>>
>>ms at probsd.org wrote:
>>
>>>replace ecerejo.Belkin with: localhost
>>>
>>>then visudo
>>>
>>>what now?
>>>
>>>michael
>>>
>>>
>>>
>>>
>>>>ms at probsd.org wrote:
>>>>
>>>>
>>>>>example - assuming your user name is noltie on a host named flowers
>>>>>
>>>>>ee /usr/local/etc/sudoers
>>>>>
>>>>>%noltie     flowers:NOPASSWD: /usr/local/bin/cdrecord
>>>>>
>>>>>Then type: visudo
>>>>>
>>>>>To close and write the change, just do: Shift+:wq
>>>>>
>>>>>then as user noltie: sudo /usr/local/bin/cdrecord
>>>>
>>>>I get an error, this is the line I used:
>>>>
>>>>%kdedude ecerejo.Belkin:NOPASSWD: /usr/local/bin/cdrecord
>>>>
>>>>and I get this error when I try saving it with visudo:
>>>>
>>>>/usr/local/etc/sudoers.tmp: 28 lines, 637 characters.
>>>>
>>>>>>>sudoers file: syntax error, line 27 <<<
>>>>>>
>>>>What now?
>>>
>>It doesn't give an error when saving if I put just this:
>>
>>%kdedude localhost = NOPASSWD: /usr/X11R6/bin/xcdroast
>>
>>but when I run it complains saying that kdedude is not in sudoers file,
>>tried it without the "%" sign and it complained again.  The only way it
>>worked was when I put this in there:
>>
>>%wheel        ALL=(ALL)       NOPASSWD: ALL
>>
>>but I don't want to do that though, I just want to be able to run a few
>>commands and not "ALL" commands.
> 
> 
> change:
> 
> %kdedude localhost = NOPASSWD: /usr/X11R6/bin/xcdroast
> 
> to
> 
> %kdedude   localhost=NOPASSWD: /usr/X11R6/bin/xcdroast
> 
> visudo
> 
> sudo /usr/X11R6/bin/xcdroast

That didn't work either but I finally got it to work, I put this line on 
my /etc/hosts file:

192.168.2.72            ecerejo.Belkin ecerejo

to create alias to ecerejo and then I edited sudoers with this:

kdedude   ecerejo=NOPASSWD:  /usr/X11R6/bin/xcdroast

and it worked.  The I replaced kdedude with %wheel to allow every member 
of the wheel group to run it and it worked also.  I had tried sudo 
before but I was unsuccessful and got even more confused reading the man 
pages now the sudoers.sample file is starting to make some sense!

Many thanks,

E. J. Cerejo





More information about the freebsd-questions mailing list