Skip to content

Instantly share code, notes, and snippets.

@fathonix
Created April 25, 2024 07:04
Show Gist options
  • Save fathonix/df9cb35c3ef7ac76150315d316da931e to your computer and use it in GitHub Desktop.
Save fathonix/df9cb35c3ef7ac76150315d316da931e to your computer and use it in GitHub Desktop.
Script to enable PAM authentication with Touch ID on macOS
#!/bin/sh
# retouchid - Script to enable PAM authentication with Touch ID on macOS
# Licensed under MIT. (c) 2022 Aldo Adirajasa Fathoni
if grep -q pam_tid.so /etc/pam.d/sudo; then
echo "Already set. no need to update /etc/pam.d/sudo."
exit 0
fi
if [ $(id -u) = 0 ];then
sed -i '' '2i\
auth sufficient pam_tid.so\
' /etc/pam.d/sudo
echo "Successfully set."
exit 0
else
echo "Error: Insufficient privileges, rerun with sudo."
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment