Use touchID for sudo in terminal instead of password


Ales Lerch
Ales Lerch
- 1 min read

This is a super simple life-changing (for me) feature where you can use touchID instead of using a super long password in your terminal. Plus this is also useful when someone is next to you and you don't need to enter your super long password.

When I have to enter a password in front of someone the feeling that they can see my password makes me screw up writing the password on the first try and I have to enter it again.
And if there is the option to use it so why not?

Here is a simple two-line shell script that sets touchID as a default option for authorization in the terminal when entering `sudo`:

#!/bin/bash 

chmod +w /private/etc/pam.d/sudo
sed -i '' -e ' 1 s/.*/&\nauth\tsufficient\tpam_tid.so/' /private/etc/pam.d/sudo
# in case of security set pam.d readonly
chmod -w /private/etc/pam.d/sudo