Bugzilla – Bug 322
Redirecting sudo password to sudo command is not working
Last modified: 2008-12-13 07:29:20 MST
Using echo command to redirect sudo password to sudo command is not working. Specifically, doing the following e.g is not working: $(echo $password)|sudo touch /opt/try.txt The sudo command is not responding to the redirection; just waiting for the input from the user regardless of the redirection. The application should accept the redirection and create the file. The bug is encountered under: Sudo version 1.6.9p10 on OS linux ubuntu 2.6.24-19-generic
sudo has to read the password directly from the tty device in order to be able to disable echo. If you want to pass it in via standard input you need to use sudo's -S flag.