title: Peer authentication failed for user in postgresql
body: <p>I am trying to run some postgresql commands through a fabric script. When I execute the script I get:</p>
  
  <pre><code>out: psql: FATAL:  Peer authentication failed for user "sparc2"
  </code></pre>
  
  <p>This is how my pg_hba.conf file looks like:</p>
  
  <pre><code># "local" is for Unix domain socket connections only
  local   all             all                                     peer
  # IPv4 local connections:
  host    all             all             127.0.0.1/32            md5
  # IPv6 local connections:
  host    all             all             ::1/128                 md5
  # Allow replication connections from localhost, by a user with the
  # replication privilege.
  #local   replication     postgres                                peer
  #host    replication     postgres        127.0.0.1/32            md5
  #host    replication     postgres        ::1/128                 md5
  # added
  local   sparc2          sparc2                                  md5
  host    sparc2          sparc2           127.0.0.1/32           md5
  host    sparc2          sparc2           10.0.2.2/32            md5
  host    all             all              all                    password
  </code></pre>
  
  <p>I have also modified the postgresql.conf file with adding this line:</p>
  
  <pre><code>listen_addresses = '*'
  </code></pre>
  
  <p>After applying the changes I restarted postgresql. But the error is still the same.</p>