How to use MacOS's Touch ID on Terminal

Camilo Martinez - Oct 8 '19 - - Dev Community

I know... use a fingerprint scanner and never come back. No need to write passwords, pins or patterns. But on the terminal when we use the magic word sudo ask for your password... yuck!!!

Yucky

Don't worry. It can be solved easily because with macOS Sonoma, there is now a supported option to enable Touch ID for sudo:

sudo cp /etc/pam.d/sudo_local.template /etc/pam.d/sudo_local
sudo nano /etc/pam.d/sudo_local
Enter fullscreen mode Exit fullscreen mode

Uncoment the last line of the file by removing the # from the start of the line.

# sudo_local: local config file which survives system update and is included for sudo
# uncomment following line to enable Touch ID for sudo
auth       sufficient     pam_tid.so
Enter fullscreen mode Exit fullscreen mode

Save changes with ctrl+x and overwritte the file.

Extra

On the default terminal works like a charm, but on iTerm2 needs an extra configuration. Go to Prefs -> Advanced -> Allow sessions to survive logging out and back in and set the value to no.

Easy Peasy Japanesey

Restart and enjoy it.


That's All Folks!
Happy Coding đź––

beer

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player