Bug 564

Summary: sudo is escaping $ leaving no access to env variables
Product: Sudo Reporter: Bert <bert.barbe>
Component: SudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED FIXED    
Severity: normal    
Priority: normal    
Version: 1.8.4   
Hardware: PC   
OS: Linux   

Description Bert 2012-07-17 14:16:08 MDT
The fix for bug 413 is to escape non-alfanumeric characters , except - and _ Because of this $ is also escaped and it's not possible anymore
to pass commands which use environment variables, braking other scripts.

Before the escaping this worked:
$ sudo -i '/bin/echo "$USER"'
root

After the escaping spaces etc. are escaped so this doesn't work anymore:
$ sudo -i '/bin/echo "$USER"'
-bash: /bin/echo "$USER": No such file or directory

And 
$ sudo -i /bin/echo '$USER'
$USER

So there's no easy way anymore to get the effect from before the escaping.On the other hand before the escaping there was another way to perform the command the fix was made for:
e.g. instead of 
$ sudo -i ls "something is here"

you could have done

$sudo -i 'ls "something is here"'
Comment 1 Todd C. Miller 2013-09-30 09:36:01 MDT
Fixed in sudo 1.8.8.