Touch ID for sudo on macOS: Four Steps of Setup and Two Places It Stops Working
Software / news
Touch ID for sudo on macOS: Four Steps of Setup and Two Places It Stops Working
A Nov. 30 post walks through sudo_local on macOS Sonoma and later. Its readers added the tmux fix, and one warns that a passwordless gdb rule is root.
A macOS user can approve sudo with a fingerprint by uncommenting one line in a file Apple ships as a template, according to a post by Modestas Valauskas dated Nov. 30. The post says the sudo_local mechanism exists "since macOS Sonoma". The Terminal did not run these steps; they are taken from the post and its comments.
The sticking point for many developers is the shell they live in. Inside tmux the prompt does not appear, and a second tool is needed.
The four-step setup
The post uses the stock pam_tid.so module and four steps:
- Copy the template:
sudo cp /etc/pam.d/sudo_local.template /etc/pam.d/sudo_local - Open the new file:
sudo nano /etc/pam.d/sudo_local - Remove the leading
#from the lineauth sufficient pam_tid.soand save. - Open a new terminal and run
sudo -vto test.
Valauskas says sufficient means a matching fingerprint is enough on its own. If you cancel the prompt, sudo falls back to your password, so a failed fingerprint does not lock you out.
A commenter, BaziBuilds, recommends editing /etc/pam.d/sudo_local rather than /etc/pam.d/sudo, because macOS updates wipe changes to the main file.
Where it stops working
| Situation | What happens | Fix named in the sources |
|---|---|---|
| Inside tmux or GNU Screen | Touch ID prompt does not appear | Install pam-reattach |
| Screen capture, sharing or recording | Stock module stops offering Touch ID | Custom module (author's own) |
| Slow fingerprint reader | Unpleasant, per one commenter | None given |
The tmux case has a documented cause. The pam_reattach README says GUI-related services such as Touch ID are tied to the login session, so they do not work from the background session tmux and Screen run in. The module moves the current program into the active login session so the later PAM modules can reach Touch ID.
The project installs with brew install pam-reattach or MacPorts. Its README gives the two lines to place in the PAM file:
auth optional pam_reattach.so
auth sufficient pam_tid.so
On Apple silicon Homebrew installs, the README says to use the full path, /opt/homebrew/lib/pam/pam_reattach.so. It suggests optional so a bug in the module cannot lock you out of sudo, and it offers an ignore_ssh option that makes the module do nothing when $SSH_CLIENT, $SSH_CONNECTION or $SSH_TTY is set. The repository shows 833 stars, 23 forks and an MIT licence, and its page gives no version number.
The screen-capture case
Valauskas wrote his own PAM module because the stock one stops offering Touch ID while the screen is being captured. His DisplayLink dock triggers that constantly, and screen sharing and recording do too. His module asks for the fingerprint through Apple's LocalAuthentication API and shows a prompt naming the requester and the full command. He says he has used it daily for about two months and installed it on two other MacBooks. The source is in the macos-touchid-sudo skill in his skills repository on GitHub.
Agent tooling is where the passwordless-rule question comes from. Projects such as Superpowers and AffrescoUI run under Claude Code, which is why a reader asked about it.
The addendum to skip
A reader, ryan-duve, added a way to let an agent user run a tool without a password: run sudo visudo and add a line such as agent_user ALL = (ALL) NOPASSWD: /usr/bin/gdb. The post warns that this is effectively root-equivalent for tools like gdb, which can spawn shells or attach to processes. Only commands you trust belong in a rule like that.
The post does not mention SSH sessions, and it links no Apple documentation, so anyone relying on this over SSH has to test it first.
Sources
More in Software
- 01Rust 1.100 Stabilises the Allocator Trait for Vec and Box, With More to ComeThe Nov. 12 release lets library authors hand a custom allocator to two collection types. A community walkthrough shows what that looks like in practice.
- 02Roc 0.1.0 Ships After Eight Years, Built on a 487-Day Rewrite From Rust to ZigThe release notes say only "Roc version 0.1.0." The numbers are in Richard Feldman's two blog posts, and several of them cut against the rewrite.
- 03A Linux Memory-Pressure Flag Throttled Every nginx Socket at CDN77 for Five HoursThe cause was a cgroup reclaim heuristic, not a lack of free RAM, and the only visible trace is a counter that arrived in Linux 6.19.
- 04Superpowers, at 330,000 Stars, Retunes Brainstorming a Third TimeIssue #2530 says the v7 questions waste tokens, and the fix in draft pull request #2756 was written by Claude Fable 5.2.