百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

sudo-touchid

> 编程语言
开源

一个支持触控 ID 的 `sudo` 分支。

1.5K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

一个支持触控 ID 的 `sudo` 分支。

sudo-touchid

sudo-touchid is a fork of sudo with Touch ID support on macOS (powered by the LocalAuthentication framework). Once compiled, it will allow you to authenticate sudo commands with Touch ID in the Terminal on supported Macs (such as the late 2016 MacBook Pros).

Screenshot

Warning

  • I am not a security expert. While I am using this as a fun experiment on my personal computer, your security needs may vary.
  • This has only been tested on the 2016 15" MacBook Pro with Touch Bar running macOS 10.12.1.

Building

To build sudo-touchid, simply open the included Xcode project file with Xcode 8+, select the Build All target, and click Build.

Running

If we try running our newly-built sudo executable now, we'll get an error:

sudo must be owned by uid 0 and have the setuid bit set

To fix this, we can use our system's sudo command and the chown/chmod commands to give our newly-built sudo the permissions it needs:

cd (built-products-directory)

sudo chown root:wheel sudo && sudo chmod 4755 sudo

Now if we try running our copy of sudo, it should work:

cd (built-products-directory)

./sudo -s

If you don't have a Mac with a biometric sensor, sudo-touchid will fail. If you'd still like to test whether the LocalAuthentication framework is working correctly, you can change the kAuthPolicy constant to LAPolicyDeviceOwnerAuthentication in sudo/plugins/sudoers/auth/sudo_auth.m. This will present a dialog box asking the user for his or her password:

While not useful in practice, you can use this to verify that the LocalAuthentication code does in fact work.

Installing

Replacing the system's sudo program is quite risky (can prevent your Mac from booting) and requires disabling System Integrity Protection (aka "Rootless").

Instead of replacing sudo, we can install our build under /usr/local/bin and give the path precedence over /usr/bin, this way our build is found first.

sudo cp (built-products-directory)/sudo /usr/local/bin/sudo

sudo chown root:wheel /usr/local/bin/sudo && sudo chmod 4755 /usr/local/bin/sudo

You can set up your PATH by adding export PATH=/usr/local/bin:$PATH to .bashrc (thanks @edenzik).

Now you should be able to enter sudo in any Terminal (or iTerm) window and authenticate with Touch ID!

Issues· 17 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言