brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: sudo_local lets you approve sudo in the Mac terminal with Touch ID

Terminal
~/tips/tip-terminal-touch-id-sudo-local

sed 's/^#auth/auth/' /etc/pam.d/sudo_local.template | sudo tee /etc/pam.d/sudo_local

Uses your fingerprint for sudo, in a way that survives macOS updates.

Typing your password for every sudo gets old on a MacBook with a fingerprint sensor. Since macOS Sonoma there is a supported file for exactly this.

macOS ships a template at /etc/pam.d/sudo_local.template with one commented line. Copy it to sudo_local with that line switched on:

sed 's/^#auth/auth/' /etc/pam.d/sudo_local.template | sudo tee /etc/pam.d/sudo_local

The result should contain this line:

auth       sufficient     pam_tid.so

Open a new terminal and run sudo -v. A Touch ID prompt appears, and the password still works as a fallback.

The older trick was to edit /etc/pam.d/sudo directly, and every macOS update put it back. Apple added sudo_local so this setting survives updates, which is why I’d only use this file.

You are editing how sudo authenticates, so be careful. Use the command above exactly, keep a second terminal with a root shell open while you test, and don’t touch the other files in /etc/pam.d. Touch ID also doesn’t help in every situation. Over SSH there is no sensor to use, and inside tmux or screen the prompt usually doesn’t appear and sudo falls back to the password. With the lid closed and no Touch ID keyboard, the same happens.

Further reading: What's new for enterprise in macOS Sonoma (Apple Support)

More Terminal tips ioreg -rn AppleSmartBattery | grep CycleCount Terminal can save your windows and tabs as a window group Export a Terminal profile to a .terminal file and import it on another Mac mc hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000029}]}' All Terminal tips (116) All topics

Link