Skip to content

Instantly share code, notes, and snippets.

@mauvehed
Last active January 27, 2023 23:35
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mauvehed/9392126bfbef1502a4c8c6d95d0e763d to your computer and use it in GitHub Desktop.
Save mauvehed/9392126bfbef1502a4c8c6d95d0e763d to your computer and use it in GitHub Desktop.
Enable sudo auth for macOS touchID via pam
#!/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