I encounter this problem when trying to list down the db for a newly installed Postgress on a machine ::
#host:>psql -Upostgres -l
psql: FATAL: Ident authentication failed for user "postgres"
What to do::
1-> su - postgres and then run psql. Or: Edit pg_hba.conf, and write trust instead of "ident sameuser" -- then reload PostgreSQL
Open up the pg_hba.conf
# Put your actual configuration here
# ----------------------------------
#
# If you want to allow non-local connections, you need to add more
# "host" records. In that case you will also need to make PostgreSQL listen
# on a non-local interface via the listen_addresses configuration parameter,
# or via the -i or -h command line switches.
#
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust <-- default is ident sameuser
# IPv4 local connections:
host all all 127.0.0.1/32 trust <-- default is ident sameuser
# IPv6 local connections:
host all all ::1/128 trust <-- default is ident sameuser