Skip to content

Instantly share code, notes, and snippets.

@Alex4386
Last active April 29, 2026 10:06
Show Gist options
  • Select an option

  • Save Alex4386/b7a9311b871786a4c6a61c9951dcdd43 to your computer and use it in GitHub Desktop.

Select an option

Save Alex4386/b7a9311b871786a4c6a61c9951dcdd43 to your computer and use it in GitHub Desktop.
Fix sudo-rs being braindead
#!/bin/bash
# Set this to 1 once sudo-rs officially supports the passprompt flag
# https://github.com/trifectatechfoundation/sudo-rs/issues/1267
DOES_SUDO_RS_HAVE_PASSPROMPT_YET=0
# Paths
SUDOERS_FIX="/etc/sudoers.d/99-rollback-sudo-rs-nonsense"
PROFILE_FIX="/etc/profile.d/99-rollback-sudo-rs-prompt.sh"
if [ "$DOES_SUDO_RS_HAVE_PASSPROMPT_YET" -eq 0 ]; then
echo 'export SUDO_PROMPT="[sudo] password for %u: "' | sudo tee "$PROFILE_FILE" > /dev/null
echo 'Defaults !pwfeedback' | sudo tee "$SUDOERS_FILE" > /dev/null
else
# in case of it being supported:
sudo rm -f "$PROFILE_FILE"
echo 'Defaults !pwfeedback, passprompt="[sudo] password for %u: "' | sudo tee "$SUDOERS_FILE" > /dev/null
fi
echo "Done. You may need to source $PROFILE_ROLLBACK or restart your shell."
@Alex4386
Copy link
Copy Markdown
Author

Run:

curl https://gist.githubusercontent.com/Alex4386/b7a9311b871786a4c6a61c9951dcdd43/raw/no-braindead-sudo-rs.sh | sudo bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment