[sudo-users] sudo and wildcards in the command line

Mark Janssen maniac.nl at gmail.com
Mon Jun 7 08:11:39 EDT 2010


On Mon, Jun 7, 2010 at 10:38 AM, Jackson <jakrainer at yahoo.com> wrote:
> Hello everyone,
>
> This is regarding the way sudo interprets wildcards in the command line.

> I´m using sudo 1.6.9.20 on AIX 6.1 and when I use, i.e. ls to list the contents of a directory that doesn´t belong to me, I get the following:
>
> $ sudo ls -l /home/user/.history/.sudo_*
> ls: 0653-341 The file /home/user/.history/.sudo_* does not exist..

Sudo (or any other program for that matter) doesn't process any
wildcards. This is done by your shell.
Since you don't have any rights to read the specific directory, your
shell can't expand the wildcard. Which leaves it as-is.
The string is literaly sent to ls, which (running as root, due to
sudo) will try to list the file ".sudo_*"
This file doens't exist, so it returns an error.

> Is this fixed on newer versions of sudo? Is there anything that I can change in the configuration file to make it work?

This is independant of sudo, I wouldn't know a 'clean' solution at the moment
sudo sh -c "ls /home/user/.history/.sudo_*" works... but isn't very
nice/safe either.


-- 
Mark Janssen  --  maniac(at)maniac.nl  --  pgp: 0x357D2178 |   ,''`.  |
Unix / Linux Open-Source and Internet Consultant @ Snow.nl |  : :' :  |
Maniac.nl      MarkJanssen.nl      NerdNet.nl      Unix.nl |  `. `'   |
Skype: markmjanssen ICQ: 129696007 irc: FooBar on undernet |    `-    |



More information about the sudo-users mailing list