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

让终端 sudo 时用上 Touch ID #15

Closed
kaidiren opened this Issue Dec 11, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@kaidiren
Copy link
Owner

kaidiren commented Dec 11, 2018

用了一段时间 MacBook Pro with TouchBar 感觉开机或唤醒时读指纹还是很方便的,但安装一些软件或执行命令操作时还是需要输入密码,似乎不那么省事,对设置复杂密码也不够友好。今天学到了一个新技巧,让我们在终端里sudo执行命令时不再需要手输密码,而是Touch ID验证。

修改/etc/pam.d/sudo这个文件,建议用
sudo vim /etc/pam.d/sudo

在第一行增加
auth sufficient pam_tid.so

现在尝试下 sudo 操作吧,应该会看到提示识别指纹而不是输入密码了。

image

如果你使用了 tmux 需要 添加额外的配置

https://github.com/fabianishere/pam_reattach

git clone https://github.com/fabianishere/pam_reattach
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local <PATH-TO-SOURCE>
make
sudo make install

修改/etc/pam.d/sudo这个文件,建议用
sudo vim /etc/pam.d/sudo

在第一行增加
auth optional pam_reattach.so

然后就可以顺利使用了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment