<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="https://uname.pingveno.net/blog/index.php/feed/rss2/xslt" ?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title># uname -a - Mot-clé - token</title>
    <link>https://uname.pingveno.net/blog/index.php/</link>
    <atom:link href="https://uname.pingveno.net/blog/index.php/feed/tag/token/rss2" rel="self" type="application/rss+xml" />
    <description>Le blog de uname.pingveno.net</description>
    <language>fr</language>
    <pubDate>Wed, 01 Apr 2026 16:19:15 +0200</pubDate>
    <copyright>Mathieu Pellegrin</copyright>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <generator>Dotclear</generator>
          <item>
        <title>Configure 2-factor Yubikey authentication for Debian : the easiest way</title>
        <link>https://uname.pingveno.net/blog/index.php/post/2013/08/06/Configure-2-factor-Yubikey-authentication-for-Debian-%3A-the-easiest-way</link>
        <guid isPermaLink="false">urn:md5:db871557ab4246d3da107e8cd37a6384</guid>
        <pubDate>Tue, 06 Aug 2013 00:20:00 +0200</pubDate>
        <dc:creator>Mathieu</dc:creator>
                  <category>Hacks</category>
                          <category>2-factor authentication</category>
                  <category>debian</category>
                  <category>PAM</category>
                  <category>server</category>
                  <category>ssh</category>
                  <category>token</category>
                  <category>yubico</category>
                  <category>yubikey</category>
                <description>          &lt;p&gt;One of last five years trending topics is the rise of Token authentication, to provide a safer way to authenticate than the classic login/password couple.&lt;/p&gt;
&lt;p&gt;Today I will show you how to configure a 2-factor authentication (login/password + yubikey), in order to use it with your local Unix users as well as with SSH login (PAM powered).&lt;/p&gt;
&lt;p&gt;In this tutorial, I will use the Yubico API, because it&amp;#8217;s simpler. When using the API, the validity check will be computed by Yubico servers. By the way, you can set up your own authentication server if you don&amp;#8217;t want to depend on Yubico servers.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;p&gt;First things first, you have to afford a Yubikey at &lt;a hreflang=&quot;en&quot; href=&quot;http://www.yubico.com/&quot;&gt;http://www.yubico.com/&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Get your &lt;strong&gt;Yubikey ID.&lt;/strong&gt; You can use the 12 first digit of every Yubikey generated password, but you can also generate it from &lt;a hreflang=&quot;en&quot; href=&quot;http://demo.yubico.com/php-yubico/Modhex_Calculator.php&quot;&gt;http://demo.yubico.com/php-yubico/Modhex_Calculator.php&lt;/a&gt;&lt;br /&gt;For lazy people, type this in a shell and activate your Yubikey&amp;#160;: &lt;code&gt;read -p &quot;Enter a YubiKey OTP: &quot; s &amp;amp;&amp;amp; echo 'The key id is' ${s:0:12}&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a &lt;code&gt;.yubico&lt;/code&gt; directory in your home, and create a file named &lt;code&gt;authorized_yubikeys&lt;/code&gt; inside it. Fill this file with your &lt;strong&gt;unix username&lt;/strong&gt; and &lt;strong&gt;Yubikey ID&lt;/strong&gt; like that&amp;#160;: &lt;code&gt;username:yubikeyid&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next, create a id/secret couple for each server ou service you want to authenticate&amp;#160;: &lt;a hreflang=&quot;en&quot; href=&quot;https://upgrade.yubico.com/getapikey/&quot;&gt;https://upgrade.yubico.com/getapikey/&lt;/a&gt;&lt;br /&gt;The ID returned after submitting the URL is the &lt;strong&gt;service ID&lt;/strong&gt;, and the &lt;strong&gt;secret&lt;/strong&gt; is the associated secret. Every pair ID/secret is unique.&lt;br /&gt;You could use the same id/secret for every server you configure, but it is not intended for&amp;#160;: you should use a different id/secret couple for every different server.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Log in to your server &lt;strong&gt;as root&lt;/strong&gt;, and install &lt;code&gt;libpam-yubico&lt;/code&gt; (from apt&amp;#160;: &lt;code&gt;apt-get install libpam-yubico&lt;/code&gt;).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;And configure it&amp;#160;: &lt;code&gt;sudo dpkg-reconfigure libpam-yubico&lt;/code&gt;. When prompted, set the &lt;strong&gt;service ID&lt;/strong&gt; in place of the N in &lt;em&gt;id=N&lt;/em&gt; and the &lt;strong&gt;secret&lt;/strong&gt; in place of the K in &lt;em&gt;key=K&lt;/em&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Then apply the configuration with the command &lt;code&gt;pam-auth-update&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That&amp;#8217;s all&amp;#160;! Every PAM-compliant authentication will now ask for the Yubikey code to authenticate (as well as login and password). When login from SSH, juste activate your Yubikey after typing your password, before typing &amp;#8220;enter&amp;#8221;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Warning&amp;#160;: if you messed up the Yubikey configuration and are using &amp;#8220;sudo&amp;#8221; before every command, you will be locked outside your server&amp;#160;! After dpkg-reconfigure, if you checked &amp;#8220;Yubico authentication&amp;#8221;,&amp;nbsp;it will ask for a Yubikey code every time a &amp;#8220;sudo&amp;#8221; authentication is required, so keep a root terminal opened to revert your changes.&lt;/strong&gt;&lt;/p&gt;</description>
        
              </item>
      </channel>
</rss>
