Bugzilla – Bug 964
sudo -S does not read password from stdin
Last modified: 2021-02-12 05:35:38 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.
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?
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. :(