Skip to content

Instantly share code, notes, and snippets.

@vraravam
Last active April 18, 2024 09:11
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save vraravam/0579373b2028e9b5b08ae87fb39c09d8 to your computer and use it in GitHub Desktop.
Save vraravam/0579373b2028e9b5b08ae87fb39c09d8 to your computer and use it in GitHub Desktop.
This script is used to setup the command-line sudo requests to fire up the fingerprint authentication on MBPs which have this feature. This file can be put anywhere in the path.
#!/usr/bin/env bash
# To be able to use the mac touchbar for sudo command auth:
# edit the following file: /etc/pam.d/sudo
# and add the following line after the initial comment line:
# `auth sufficient pam_tid.so`
# This script also verifies that this line is added only once (ie skips if already present)
COUNT=`grep pam_tid /etc/pam.d/sudo | wc -l`
if [[ $COUNT -gt 0 ]]; then
echo "ALREADY PRESENT - Not adding again!!!"
else
echo "INCLUDING NEW LINE!!!"
sudo sed -i '' '2i\
auth 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