Files

15 lines
515 B
Bash
Executable File

#!/usr/bin/env bash
# sudo-askpass: GUI password prompt for sudo via $SUDO_ASKPASS.
#
# sudo calls the program pointed to by $SUDO_ASKPASS when it cannot prompt on a
# terminal (or with `sudo -A`) and reads the password from its stdout. zenity's
# --password dialog does exactly that. If the dialog is cancelled or times out
# zenity exits non-zero and sudo aborts.
set -uo pipefail
exec zenity --title="sudo authentication" \
--password \
--text="Enter password for $(id -un):" \
--timeout=120 2>/dev/null