-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apple Watch authentication for sudo [macOS Sonoma 14.0] #26
Comments
Taking a quick look at the source of |
it does trigger my Apple Watch for permission when I attempt to sudo (with the stock pam_tid.so added in the stock sudo_local).. |
It does not trigger my watch for authentication using the standard sudo_local config. It only triggers touchid. Edit: Adding this plugin and enabling it in sudo_local breaks sudo completely, though.
|
yep, it works, following https://sixcolors.com/post/2023/08/in-macos-sonoma-touch-id-for-sudo-can-survive-updates/ , running echo "auth sufficient pam_tid.so" | sudo tee -a /etc/pam.d/sudo_local open new shell and try Copying the steps here for posterity
BY DAN MOREN ■ MACOS SONOMA However there’s been one drawback to enabling that feature: because it means altering a system file, the change wouldn’t generally survive a system update—the file would get overwritten by the stock file every time macOS released a new version, meaning you’d have to go in and make the change again. I’m probably not alone in having given up on having Touch ID enabled, rather than playing the constant cat-and-mouse game. But wait, there’s good news: in macOS Sonoma, Apple appears to have provided a new framework to work around this problem. As Mastodon user Rachel pointed out, Sonoma allows for an additional file that will persist through updates. So you can make the change once and it should stick. From what I can tell, this system was put in place precisely for this feature. Apple provides a sudo_local.template file as an example, which not only contains a comment explaining that sudo_local will survive updates, but also even includes the code necessary to enable Touch ID. So, without further adieu, here are the steps for enabling this feature in macOS Sonoma, once and for all:
Next, copy Apple’s provided template to the actual file that the system will read. You’ll need to use sudo and enter your administrator password to get permission:
Finally, open up the file you just made using your text editor of choice; I prefer pico. You’ll need to use sudo again here.
In that file, navigate to the line that contains with pam_tid.so and delete the hashtag (#) at the beginning. Save the file out by pressing Control-X, typing ‘Y’ to save your changes, and hitting Return. That’s it; you’re done! We’ll have to wait and see if this truly works as described, but fingers crossed you should be able to keep Touch ID access for sudo for ever and ever. [Dan Moren is the East Coast Bureau Chief of Six Colors. You can find him on Mastodon at @[email protected] or reach him by email at [email protected]. His latest novel, the supernatural detective story All Souls Lost, is out now.] If you appreciate articles like this one, support us by becoming a Six Colors subscriber. Subscribers get access to an exclusive podcast, members-only stories, and a special community. |
glad to know I'm not the only one it works "out-of-the-box" for.. In conclusion: This plugin is NOT REQUIRED on macOS Sonoma, enabling the STOCK pam_tid.so will trigger both Touch ID and Apple Watch for |
There is a 1/2 second gap between the touch-id popup and Apple watch, which does make sense give its two different devices connected over Bluetooth. |
Does it work when the MacBook is in clamshell mode (lid closed)? |
I can confirm just enabling pam_tid.so works for Apple Watch Touch ID, but only if you've enabled this in: System Settings.app -> Touch ID & Password -> Apple Watch: Use Apple Watch to unlock your applications and Mac Can't test what happens with the clamshell closed because I don't have an external display and am on battery right now, which means I can't prevent the machine from going to sleep before triggering |
On a related note, does it work on Macs without Touch ID |
I've just tested this. It does not. |
After further testing this morning, I realized that my issue is that it doesn’t do the watch when in clamshell mode because it senses there’s no TouchID so it does nothing. It does, however, do the watch when TouchID is available, but I never noticed because I don’t use it that way much and TouchID pops up first. |
These are my observations too. I think this suggestion above (#26 (comment)) will probably work from clamshell, but I've not tested yet. |
@deed02392 Is there a way to use my watch and Touch ID for One of my friends would unlock my MacBook when I walk away by picking it up and bringing it close to me then going back to where they were. |
Hey @Logicer16 I noticed you have a fork of this repo that is maintained, do you happen to know if this works with a mac mini without touchID? I do have a magic keyboard stored that I don't want to use |
If I connect the magic keyboard to my mac mini, it does enable Touch ID and sudo works with my apple watch, just using the |
Does watch auth work just by virtue of the touch id being registered? You could always simply leave it registered and then put the keyboard away again |
Yes @deed02392, watch auth works by just having the keyboard with touch id |
ah, that is similar to other comments from this thread. It sounded like the issue was in the Apple applied Pam_tid library |
Yes, it should still work. Up until earlier this year, I've been using my fork without issue on a MacBook without Touch ID. The install script in my fork adds both example `sudo_local` created by my fork
If you encounter any issues, please do let me know.
The difference lies in the policy used by each module. Whereas As per the docs for the latter:
The fact it also prompts for watch authentication is undocumented behaviour and possibly a bug. |
Thanks for that @Logicer16, I tried using your repo, but I got the following error: ❯ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/logicer16/pam-watchid/HEAD/install.sh)" -- enable
Cloning into 'pam-watchid'...
remote: Enumerating objects: 83, done.
remote: Counting objects: 100% (38/38), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 83 (delta 27), reused 23 (delta 23), pack-reused 45 (from 1)
Receiving objects: 100% (83/83), 1.27 MiB | 1.11 MiB/s, done.
Resolving deltas: 100% (42/42), done.
swiftc watchid-pam-extension.swift -o pam_watchid_x86_64.so -target x86_64-apple-darwin23.6.0 -emit-library
watchid-pam-extension.swift:84:10: error: type 'LAPolicy' has no member 'deviceOwnerAuthenticationWithBiometricsOrCompanion'
.deviceOwnerAuthenticationWithBiometricsOrCompanion
~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [all] Error 1 The part Keep in mind that I'm using Apple's
|
My fault. Should be fixed now. Wasn't thinking of older macOS versions when I made that change. If you find any other issues, consider opening an issue on my fork to keep this issue on topic. |
Appreciate it @Logicer16, I forgot to mention that I'm still using |
I created a video on how to set all of this up in case someone is interested |
It seems that Apple Watch authentication for sudo on macOS Sonoma 14.0 is supported out-of-the-box now.. This doesn't need to be installed for it to work. Seems they've also added support for /etc/pam.d/sudo_local to persist the pam_tid.so line, which is pre-loaded in the OS, but commented out..
The text was updated successfully, but these errors were encountered: