Bug 964 - sudo -S does not read password from stdin
sudo -S does not read password from stdin
Status: RESOLVED WORKSFORME
Product: Sudo
Classification: Unclassified
Component: Sudo
1.9.5
PC Linux
: low normal
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2021-02-11 06:33 MST by buzo
Modified: 2021-02-12 05:35 MST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description buzo 2021-02-11 06:33:22 MST
«sudo -S» does not read the password from stdin any more. Instead, the -S is completely ignored and the regular password input happens, if connected to a terminal. If not, these two lines are printed:

sudo: no password was provided
sudo: a password is required

This is a regression in 1.9.5p2. It used to work till 1.9.5p1.
Comment 1 Todd C. Miller 2021-02-11 08:39:59 MST
I'm unable to reproduce your problem and there weren't any changes between 1.9.5p1 and 1.9.5p2 that would explain it.  Here's what I see with 1.9.5p2 on Ubuntu 20.04.2:

$ echo test123 | sudo -Sk id
[sudo] password for testuser: 
uid=0(root) gid=0(root) groups=0(root)

And here it is with no tty:

$ tty
not a tty
$ echo test123 | sudo -Sk id
[sudo] password for testuser: 
uid=0(root) gid=0(root) groups=0(root)

Are you using pre-built packages or did you compile sudo yourself?
Comment 2 buzo 2021-02-12 05:35:38 MST
Sorry for wasting your time, it was a bug in my script, not in sudo. I somehow managed to call ssh with the -n option, which obviously does not let the password through to sudo. :(