sudo-rs cannot authenticate via stdin when no TTY is present, breaking Ansible (and any tool using `sudo -S`)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- ansible, rust, ubuntu
- Domain
- authentication, cli, operating-systems, security
Research direction
Start by reproducing the issue with sudo -v <<< "your-password" without a TTY, then compare the behavior with traditional sudo and the Ansible become command described here. Trace the sudo-rs authentication entry point and existing tests for stdin, TTY, or password handling; done means correct passwords supplied through stdin authenticate successfully without a controlling TTY and the Ansible reproduction succeeds.
Written by the indexing model from the issue text.
Description
Summary
When sudo-rs is the active sudo implementation (via update-alternatives,
as it now is by default on Ubuntu 26.04 LTS), it refuses to authenticate a
password supplied over stdin when no controlling TTY is attached — even
though the traditional sudo package (still installed alongside it) handles
this correctly. This breaks any tool that automates privilege escalation
non-interactively, including Ansible's become mechanism, which is a very
widely used pattern.
Steps to reproduce
- On a system where
sudo-rsis the activesudoalternative, attempt to
authenticate with a password piped over stdin and no TTY:sudo -v <<< "your-password" - Observe the failure:
sudo: A terminal is required to authenticate - Switch to traditional sudo and repeat the identical command:
sudo update-alternatives --set sudo /usr/bin/sudo.ws sudo -v <<< "your-password" - This succeeds silently (exit 0, timestamp cached) — identical stdin,
identical password, only thesudoimplementation changed.
Ansible-specific reproduction (the real-world trigger)
ansible localhost -c local -b -m command -a whoami -e ansible_become_pass=your-password
With sudo-rs active:
[ERROR]: Task failed: Timed out waiting for become success or become password prompt.
>>> Standard Error
[sudo: [sudo via ansible, key=<redacted>] password:] Password:
With traditional sudo active (only variable changed): CHANGED | rc=0 >> root
Expected behavior
sudo -S-style non-interactive authentication (password supplied via stdin,
no TTY) should succeed when the password is correct, matching traditional
sudo's behavior, since sudo-rs is documented as a drop-in replacement with
compatible sudoers/PAM handling.
Actual behavior
sudo-rs unconditionally requires a real TTY to authenticate and rejects
stdin-supplied credentials with sudo: A terminal is required to authenticate, regardless of whether the password is correct. This silently
breaks any automation (Ansible, and likely other config-management/CI tools
using the same sudo -S convention) the moment sudo-rs becomes the active
sudo — which, as of Ubuntu 26.04 LTS, is the out-of-the-box default.
Environment
- OS: Kubuntu 26.04 LTS
sudo-rsversion:0.2.13-0ubuntu1sudo(traditional) version, installed side by side:1.9.17p2-1ubuntu3ansible-coreversion: reproduced identically on both2.20.1(the
distro package) and2.19.12(via pipx) — ruling out ansible-core as the
causeupdate-alternativesforsudodefaults to thesudo-rsbinary
(/usr/lib/cargo/bin/sudo, priority 50) over traditional sudo
(/usr/bin/sudo.ws, priority 40)
Additional context
Impact
Because Ubuntu 26.04 LTS ships sudo-rs at a higher update-alternatives
priority than traditional sudo by default, this breaks Ansible provisioning
(and presumably other automation) on a stock fresh install, with no error
message pointing at the actual cause — the failure surfaces as an opaque
timeout deep inside the automation tool, not as a sudo-rs error. Given how
common sudo -S-based automation is, this seems likely to affect a lot of
people upgrading/reinstalling to 26.04 without realizing why their existing
playbooks/scripts suddenly hang.
- Dominant language
- Rust
- Stars
- 4.5k
- Forks
- 179
- Avg merge
- 16h 45m
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from trifectatechfoundation/sudo-rs
-
C-cli enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
trifectatechfoundation/sudo-rs#1659 · 9 comments · 3 reactions ·
-
consultation enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
trifectatechfoundation/sudo-rs#1596 · 5 comments ·
-
documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
trifectatechfoundation/sudo-rs#1564 ·
-
chore enhancement
trifectatechfoundation/sudo-rs#1679 · 4 comments · 1 assignee ·
-
C-exec C-pam consultation enhancement
Difficulty 4/5 3-5 days Newbie friendliness 35/100
trifectatechfoundation/sudo-rs#1665 ·
All issues in trifectatechfoundation/sudo-rs
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100