Skip to content

Instantly share code, notes, and snippets.

@isaac-ped
Last active June 22, 2023 17:05
Show Gist options
  • Save isaac-ped/80e4beed58cb2b1959e0276bc2cb42bc to your computer and use it in GitHub Desktop.
Save isaac-ped/80e4beed58cb2b1959e0276bc2cb42bc to your computer and use it in GitHub Desktop.
Enable touch-id authentication for sudo privileges on mac OS
#!/usr/bin/env bash
# From: https://it.digitaino.com/use-touchid-to-authenticate-sudo-on-macos/
# Check if it's already done
if grep 'auth[[:space:]]*sufficient[[:space:]]*pam_tid.so' /etc/pam.d/sudo; then
echo "Already done"
else
# One-liner to do it
sudo sed -i.backup 's/\(auth[[:space:]]*sufficient[[:space:]]*pam_smartcard.so\)/\1\nauth sufficient pam_tid.so/' /etc/pam.d/sudo
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment