Last active
September 27, 2024 21:59
-
-
Save mauvehed/9392126bfbef1502a4c8c6d95d0e763d to your computer and use it in GitHub Desktop.
Enable sudo auth for macOS touchID via pam
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# credit to machupicchubeta/dotfiles/bin/enable_to_sudo_authenticate_with_touch_id.sh | |
set -eu | |
set -o pipefail | |
sudo chmod +w /etc/pam.d/sudo | |
if ! grep -Eq '^auth\s.*\spam_tid\.so$' /etc/pam.d/sudo; then | |
( set -e; set -o pipefail | |
# Add "pam_tid.so" to a first authentication | |
pam_sudo=$(awk 'fixed||!/^auth /{print} !fixed&&/^auth/{print "auth sufficient pam_tid.so";print;fixed=1}' /etc/pam.d/sudo) | |
sudo tee /etc/pam.d/sudo <<<"$pam_sudo" | |
) | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment