[sudo-users] Why sudo(1) asks for password when stdout and stderr are redirected?
Vladimir Barbarosh
vladimir.barbarosh at gmail.com
Tue Apr 26 16:42:26 EDT 2011
Hi.
robot:
#!/bin/bash
sudo echo apple
sudo cat << EOF
banana
EOF
command prompt:
$ sudo true
[sudo] password for vb:
$ ./robot
apple
banana
$ ./robot > /dev/null
$ ./robot &> /dev/null
[sudo] password for vb:
Why sudo(1) asks for password when stdout and stderr are redirected?
I already asked this question on http://superuser.com (http://bit.ly/hSvAXk).
>From this answer (http://bit.ly/fqpapQ) I conclude that this is a bug because
"on my system (ubuntu 10.04), sudo asked for my password when I
redirected stdout." But on my system (Debian 6.0.1) everything ok when I
redirect only stdout.
I read Wikipedia page (http://en.wikipedia.org/wiki/Sudo), and FAQ
(http://www.sudo.ws/sudo/troubleshooting.html). I skim manual page
(http://www.sudo.ws/sudo/man/1.8.1/sudo.man.html) and even do
some googling, but still I can't answer why sudo(1) ...
Can anyone help me please?
--
Vladimir Barbarosh
More information about the sudo-users
mailing list