title: How to disable password authentication for every users except several
body: <p>I want to share my answer for question in title, which I can't find quickly.</p>
  
  <p>There many topics how to disable password auth at all:</p>
  
  <pre><code>UsePam yes # it will not be used
  ChallengeResponseAuthentication no
  PasswordAuthentication no
  kbdInteractiveAutentication no
  </code></pre>
  
  <p>but no topics how to enable for paticular user:</p>
  
  <pre><code>Match User myuser
      PasswordAuthentication yes
      KbdInteractiveAutentication yes
  </code></pre>
  
  <p>Also useful command to test sshd config is:</p>
  
  <pre><code>sshd -T -C user=myuser,host=127.1,addr=127.1
  </code></pre>
  
  <p>Please, note that "127.1" will not work on every system, so you may need paste 127.0.0.1 here.</p>