escaping * in sudoers

Aaron Spangler aaron at spangler.ods.org
Mon Mar 8 22:23:30 EST 2004


Barbara,

When one runs: sudo ls *, the * character is interpreted by the current shell 
you are using.  It replaces the * character with a list of files in your own 
directory before passing it to sudo.  For example, if your directory 
contained three files (called one, two, three respectively), and you did a 
'sudo ls *', sudo gets passed the options 'ls one three two'.  Next sudo 
tries to match it against '/usr/bin/ls *'.  Since sudo never receives the *,  
the comparison fails and the command is denied.

However if you were to type 'sudo ls \*', then sudo actually gets passed the 
*.  However you have to train your users to put the back slash in.  (The 
backslash does not need to go into /etc/sudoers.)

I hope this is helpfull.

 -Aaron

On Monday 08 March 2004 08:53 am, barbara.ruess at allianz.de wrote:
> According to sudo documentation you can escape a special character in the
> sudoers file by \.
> I am trying to give a user permission for a command that contains an
> astrisk, le's say   ls *.
> But I can't put this in the sudoers file:
> testuser testhost=(ROOT) NOPASSWD:/usr/bin/ls \*
>
> >>> sudoers file: syntax error, line 540 <<<
>
> What now?
>
> WHY??
> Regards, Barbara
>
> Barbara Ruess
> _______________________________________________________
> AG2CEA05
>
> Tel.: 0711-663-2516                         Leuschnerstr. 12, 70174
> Stuttgart
> Fax: 0711-663-82516                       email: barbara.ruess at allianz.de
>
>
> ____________________________________________________________
> sudo-users mailing list <sudo-users at sudo.ws>
> For list information, options, or to unsubscribe, visit:
> http://www.sudo.ws/mailman/listinfo/sudo-users




More information about the sudo-users mailing list