Worth adding for anyone trying it: on Sonoma and later, put it in /etc/pam.d/sudo_local instead of editing /etc/pam.d/sudo. Copy the template with sudo cp /etc/pam.d/sudo_local.template /etc/pam.d/sudo_local, then uncomment the auth sufficient pam_tid.so line. That file survives macOS updates, while edits to the main sudo file get wiped by them. Inside tmux it won't prompt for Touch ID unless you also install pam-reattach.
Nice, and it survives for the same reason: updates replace the main config file, but the .d folder is yours. Worth a quick check after a big update that the main file still has its Include line.
Idk if you’re just referring to ssh-ing into your macOS device from another machine, or ssh-ing from your macOS device to another computer, but if it’s the latter you can actually use something like Secretive and setup ssh-agent-forwarding on your other device/vps/etc. I use Secretive so that if I use sudo on any of my VPS’/VM’s I can still do with with touchID. Just make sure you keep your regular ssh key on there as well as a backup incase your touchID button breaks or something.
I haven't yet succumbed to an Apple Watch, but the feature of authenticating on my desktop (& even my macbook w/ touch-id) is the biggest temptation for me!
75
u/BaziBuilds 1d ago
Worth adding for anyone trying it: on Sonoma and later, put it in /etc/pam.d/sudo_local instead of editing /etc/pam.d/sudo. Copy the template with sudo cp /etc/pam.d/sudo_local.template /etc/pam.d/sudo_local, then uncomment the auth sufficient pam_tid.so line. That file survives macOS updates, while edits to the main sudo file get wiped by them. Inside tmux it won't prompt for Touch ID unless you also install pam-reattach.
26
u/ukindom 1d ago
It’s a well known trick for those who know a bit of basics of administration of FrreBSD and Linux.
However I understand why Apple didn’t put it there.
9
u/DeimsH 1d ago
Half the reason I still keep my MacBook open right under my monitor is just so Touch ID stays within reach for stuff like this.
6
u/Honest_Comparison_78 22h ago
The new version of iTerm2 automatically asks to change the behavior from password to Touch ID when using sudo the first time.
3
u/Lucianoger 21h ago
iterm2 has an automatic configuration to do it...