DEV Community

Cover image for Unlock "sudo" with TouchID on your Mac
Marc Backes
Marc Backes

Posted on • Originally published at marc.dev

1 1

Unlock "sudo" with TouchID on your Mac

Since I got my Magic Keybord with integrated TouchID, I don't rely on my password anymore to authenticate myself on my local machine. So I thought why not enable it for "sudo" commands in the Terminal as well?

Here is how:

Copy sudo_local file

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

Edit sudo_local file

Uncomment the following line in the newly copied sudo_local file (e.g. with sudo vi /etc/pam.d/sudo_local):

auth       sufficient     pam_tid.so
Enter fullscreen mode Exit fullscreen mode

Save the file, and voilà!

You might have to exit your current shell or open a new one before it works

Top comments (1)

Collapse
 
andrewsavetchuk profile image
Andrew Savetchuk

Great idea! However, I didn't have the sudo_local.template file on my Mac. I only had /etc/pam.d/sudo. After adding the line there and restarting the terminal, everything worked! 🎉

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay