Bug 322

Summary: Redirecting sudo password to sudo command is not working
Product: Sudo Reporter: Mariam <shamsi84>
Component: SudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED INVALID    
Severity: normal    
Priority: low    
Version: 1.7.0   
Hardware: PC   
OS: Linux   

Description Mariam 2008-12-13 02:02:26 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
Comment 1 Todd C. Miller 2008-12-13 07:29:20 MST
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.