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!!!
Don't worry. It can be solved easily. Edit this file /etc/pam.d/sudo with your favorite editor. Mine is the VS Code because can deal with admin permission. Run this command on a terminal.
code /etc/pam.d/sudo
Add the following line on top
auth sufficient pam_tid.so
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.
Restart and enjoy it.
That's All Folks!
Happy Coding 🖖



Top comments (18)
There is an extra step needed for some guys using display docks.
I followed the above steps, but got GUI password prompt instead of touchID
After I ran this. It works prefect now.
defaults write com.apple.security.authorization ignoreArd -bool TRUE
source: apple.stackexchange.com/questions/...
Thanks! After applying this (and the instructions from the author) I started to get the biometric password prompt.
Awesome. Works!
After each macOS update the file is reset to initial state. Is it possible to somehow automate this process? So after each update some script will run to append the line in the file?
this is what I use as an alias in my shell
alias enable-fingerprint="sudo sed -i '1 i\auth sufficient pam_tid.so' /etc/pam.d/sudo"just make sure that u use gnu-sed (at least that is what I tried)
I have tried your approach but with no success. Mine was standard macOS' sed and it requires additional params '' after -i. Anyway I found working variant:
Anyway thank you
that can be cause the gnu-sed and macos' sed are not the same. Nice that you got it to work
Maybe with some
bash/zshscript.Really slick UX here
Works like a charm
Just perfect! 👏
Gracias amigo y ¡¡Viva Colombia!!
Saludos desde Chile 🇨🇱
Con gusto Andrés!
Many thanks. Works great!!!
This is great! Just what I was looking for!
Bless your soul
Is there a way to make this work on the VS Code integrated terminal?
I used to have this configuration, and also works on VS Code.