<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Aaron Ji's blog (Posts about touchid)</title><link>https://blog.jiya.net/</link><description></description><atom:link href="https://blog.jiya.net/categories/touchid.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2025 &lt;a href="mailto:me@jiya.net"&gt;Aaron Ji&lt;/a&gt; </copyright><lastBuildDate>Wed, 19 Feb 2025 06:17:18 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Enable sudo touch id on macOS</title><link>https://blog.jiya.net/posts/2021/12/macos-enable-touchid.html</link><dc:creator>Aaron Ji</dc:creator><description>&lt;div id="outline-container-orga51eb13" class="outline-2"&gt;
&lt;h2 id="orga51eb13"&gt;edit &lt;code&gt;/etc/pam.d/sudo&lt;/code&gt; file, put follow text at the beginning of the file.&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-orga51eb13"&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;auth sufficient pam_tid.so
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Now, you can use touchid instead of password in normal terminal.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-org82bb530" class="outline-2"&gt;
&lt;h2 id="org82bb530"&gt;if you want to use touchid with tmux, you should also install &lt;a href="https://github.com/fabianishere/pam_reattach"&gt;pam_reattach&lt;/a&gt; module.&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org82bb530"&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;git clone https://github.com/fabianishere/pam_reattach
cd pam_reattach &amp;amp;&amp;amp; mkdir build &amp;amp;&amp;amp; cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local ..
make
sudo make install
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Then, edit &lt;code&gt;/etc/pam.d/sudo&lt;/code&gt; file, put the follow text at the beginning of the file.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;auth optional pam_reattach.so
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;
The result sudo file should be as following:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;# sudo: auth account password session
auth optional pam_reattach.so
auth sufficient pam_tid.so
auth       sufficient     pam_smartcard.so
auth       required       pam_opendirectory.so
account    required       pam_permit.so
password   required       pam_deny.so
session    required       pam_permit.so
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="outline-container-org98582d8" class="outline-2"&gt;
&lt;h2 id="org98582d8"&gt;Note that the latest macOS 14 (Sonoma) have a simple way to enable touchid for sudo&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org98582d8"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;create a new file &lt;code&gt;/etc/pam.d/sudo_local&lt;/code&gt;&lt;/li&gt;

&lt;li&gt;add following text to the file&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;# sudo_local: local config file which survives system update and is included for sudo
# uncomment following line to enable Touch ID for sudo
auth       sufficient     pam_tid.so
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</description><category>macOS</category><category>tmux</category><category>touchid</category><guid>https://blog.jiya.net/posts/2021/12/macos-enable-touchid.html</guid><pubDate>Wed, 15 Dec 2021 05:12:00 GMT</pubDate></item></channel></rss>