Use Touch ID for sudo on Mac
The landscape of security is changing quite a bit. We've gone from basic username and password to 2FA, facial recognition, fingerprint recognition, and so on. Hell, my Mac unlocks simply when I have my Apple Watch near by. In the end, I probably use the Mac fingerprint key the most.
One functionality that still requires manually typing a password is using sudo
from command line. Did you know, however, that you can instead require the fingerprint key instead of typing out your password?
# Open the sudo utility
sudo vi /etc/pam.d/sudo
# Add the following as the first line
auth sufficient pam_tid.so
Whether or not you'd prefer to type it out or simply use the fingerprint is obviously personal preference. Since you expect to be be typing in a command line, moving your finger to touch the key is probably not very efficient. If you do want to use fingerprint, however, here you go!
Today we get to play amazing games on our super powered game consoles, PCs, VR headsets, and even mobile devices. While I enjoy playing new games these days, I do long for the retro gaming systems I had when I was a kid: the original Nintendo...
If you follow me on Twitter, you know that I've been working on a super top secret mobile application using Appcelerator Titanium. The experience has been great: using JavaScript to create easy to write, easy to test, native mobile apps has been fun. My...
One of the famous MooTools plugins is Harald Kirschner's AutoCompleter plugin. AutoCompleter takes a term input by the user and searches for matches -- an obviously help to the user. Here's how to make the most of Harald's great plugin.
The XHTML
All we...
We all know that each browser vendor takes the liberty of implementing their own CSS and JavaScript features, and I'm thankful for that. Mozilla and WebKit have come out with some interesting proprietary CSS properties, and since we all know that cementing standards...
First you need to make the file writable (it is not by default). And you need to do this after every macOS update, because macOS updates reset the file content.
Nice trick. Unfortunately, on Big Sur, at least, it pops up the touch id alert to use it only when the session is terminated, so it’s not useful.
But it is read-only!
As the co-author of sudo, I am amused :)
No need to make it writable when editing it with vi, you just add a
!
to the save and exit command (:wq!
) and it will save it corectly – it will even preserve the read only state of the file.Works nicely on Big Sur for me, it pops up the touch id alert, I touch and sudo all the things =)
Is there a way to make sudo work with the Apple Watch as well?
You can also:
*browse to the folder using finder,
*edit the file with vscode, or any other code editor
*save it to desktop
*delete original file
*and place the edited
same with nano you don’t need to make it writable.
You may want to update this for Sonoma – or simple add a pointer to https://0xmachos.com/2023-10-01-Touch-ID-sudo/