Now that I've got a mac with TouchID, I rarely use my password. It's incredible how convenient that little button is. One place I found myself still typing my password was running sudo
commands in the terminal.
Here's how you can use TouchID with the terminal too!
First, open the /etc/pam.d/sudo
in an editor with admin permissions. I had to use sudo
to do this with the following command:
1sudo code /etc/pam.d/sudo
1sudo code /etc/pam.d/sudo
Add auth sufficient pam_tid.so
to the file, here's what mine looks like now:
(I only added the line with pam_tid.so
on it.)
1# sudo: auth account password session2auth sufficient pam_tid.so3auth sufficient pam_smartcard.so4auth required pam_opendirectory.so5account required pam_permit.so6password required pam_deny.so7session required pam_permit.so
1# sudo: auth account password session2auth sufficient pam_tid.so3auth sufficient pam_smartcard.so4auth required pam_opendirectory.so5account required pam_permit.so6password required pam_deny.so7session required pam_permit.so
iTerm has an advanced option that you also need to set for this to work properly. Go to
Preferences ⇒ Advanced ⇒ Allow sessions to survive after logging out and back in
Change this setting to No
.
Restart iTerm and try it out!