An easy trick I have found to set postgres password: $ sudo passwd
postgres, and now you can type a new password. So now you can switch
user with: $ su postgres, and then connect to the DB with psql.
Beware of pg_hba.conf, it is a bit tricky to understand how the
mechanism of authentification works whether you are on localhost or
remote.