How to use sudo with Touch ID on your Mac

Use Terminal often? This tip from Cabel Sasser could help speed up your workflow.

Here's a tip from Cabel Sasser of Panic for those of you out there with Touch Bar MacBook Pros who use Terminal and the "sudo" command frequently.

Here's the full step-by-step, for those who want to experiment. That said: sudo is an incredibly powerful command in the Terminal; we don't recommend messing around with this trick if you don't feel comfortable working in the Terminal app and changing system preference files.

Want to learn Terminal? Here are 15 commands we think every user should know.

Also worth noting, via Sasser:

How to enable Touch ID for sudo commands on your MacBook Pro with Touch Bar

  1. In Safari, paste the following into the search bar: file:///etc/pam.d/sudo.

    Alternatively, go to Finder > Macintosh HD > private > etc > pam.d > sudo. (Note: You may need to first reveal hidden files to see the private directory.)

  2. Press Command-I with the sudo file highlighted to open up the information screen.

  3. Click on the Lock icon in the bottom right corner.
  4. Enter your authentication information (or use Touch ID).
  5. Change the privileges of all users to Read & Write.

  6. Download TextWrangler, a free plain text editor, or use the plain text editor of your choice.
  7. Open the sudo file in TextWrangler (or equivalent).
  8. Paste auth sufficient pam_tid.so on the first line of the document.

    Note: If you get a note about the document being locked, go back to step 2-5 and make sure you've enabled Read & Write privileges on the document.

  9. Save the sudo file and close it.

  10. In Finder, press Command-I with the sudo file highlighted to open up the information screen.
  11. Change the privileges on all users to Read only.
  12. Click on the Lock icon in the bottom right corner.

Now, when you open Terminal and attempt a sudo command, you should be prompted with a Touch ID authentication in lieu of entering your administrator password.

Questions?


Let us know below.

Comments are closed.