How ToMac

macOS How To: Use Touch ID to authenticate as sudo in Terminal

TL;DR: 

To authenticate as sudo in Terminal, paste the following line into /etc/pam.d/sudo

auth       sufficient     pam_tid.so
Step-by-step Instructions:

Firstly you’ll need to open /etc/pam.d/sudo in a file editor within Terminal. You can do this by running the following command:

sudo vi /etc/pam.d/sudo

Then, press the key on your keyboard, this will allow you to insert text.

Then, paste the following line into the file – you’ll need to use the keyboard for navigating around the file, but you can use the right click context menu to paste (or CMD or Edit > Paste).

I made a new line below the first line, but it can go anywhere as long as it’s on a new line:

auth       sufficient     pam_tid.so

Then, press the escape key on your keyboard. Then type :wq! and press enter. This will save the changes to the file.

Lastly, quit Terminal by pressing CMD + Q. Then relaunch Terminal and run a command as sudo (e.g; sudo -i to change to root in Terminal) to test.

Jonathan Procter

Linux, Unix, and Windows server sysadmin.

Related Articles

Check Also
Close
Back to top button