title: What's the difference between "local" and "localhost" connection types in pg_hba.conf?
body: <p>This is the relevant part of my <code>pg_hba.conf</code>:</p>
  
  <pre><code># TYPE  DATABASE        USER            ADDRESS                 METHOD
  
  # "local" is for Unix domain socket connections only
  local   all             all                                     ident
  # IPv4 local connections:
  host    all             all             127.0.0.1/32            ident
  # IPv6 local connections:
  host    all             all             ::1/128                 ident
  </code></pre>
  
  <p>The pidentd service is running.</p>
  
  <p>When I try to log onto ee1 (I assume, the default user is postgres) :</p>
  
  <pre><code>psql ee1 
  </code></pre>
  
  <p>It says "peer authentication failed for user postgres"</p>
  
  <ol>
  <li><p>Where have I configured <code>peer</code> authentication for "postgres" ? It's <code>ident</code>.</p></li>
  <li><p>When I change the following line in <code>pg_hba.conf</code>:</p>
  
  <pre><code>local   all             all                                 ident
  </code></pre>
  
  <p>to</p>
  
  <pre><code>local   all             all                                 md5
  </code></pre>
  
  <p>it asks me for a password, and I am able to log in. Why is it that making changes to the local connection type, have effect on postgres user?</p></li>
  </ol>