Brian May <br...@microcomaustralia.com.au> wrote: On 26 September 2014 14:15, Russ Allbery <r...@debian.org> wrote: That would surprise me. In one case, you're setting an environment variable and then running sudo. In the other case, you're telling sudo to run the command "echo='() { /bin/echo bar; }' echo foo" via a shell. No, I don't think that is the case. I believe sudo interprets those assignments itself (as also shown in man page), and the error I got clearly shows this to be the case. brian@aquitard:~$ sudo echo='() { /bin/echo bar; id; }' ./test.sh sudo: sorry, you are not allowed to set the following environment variables: echo My understanding is that sudo doesn't invoke any sort of shell unless you expressly tell it to do so.
Does it also apply to variables that are part of env_keep in sudo? For example if you set TZ, PS1 or XAUTHORITY, which are preserved by default. -- Joss