Postgres password authentication fails

view story

http://askubuntu.com – I've installed PostgreSQL 9.1 and pgadmin3 on Ubuntu Server 13.10. I configured postgresql.conf with: listen_addresses = '*' also I configured ph_hba.conf by changed peer connections to md5 Plus I reset the password of postgres by: sudo password postgres then restarted the service with sudo /etc/init.d/postgresql restart after that I tried to connect to the default PostgreSQL template database: sudo -u postgres psql template1 but login failed with this error message: psql: FATAL: password authentication failed for user "postgres" then I tried to login from the pgadmin, which gave (HowTos)