You need to learn more about HBA configuration.
There are some basic authentication methods:
- trust - every users can connect to database(s) specified at second column where all means just all databases in cluster (yeah, excluding template0, because datallowconn in pg_database system catalog is set to false.. nevermind)
- ident (prior to PostgreSQL 8.4 ident sameuser) - only actually logged (for example using su in console as your
su - postgres
) system user (with same name as role name) can connect
- md5 - every user that knows role (PostgreSQL) password can log to database
Every time you attempting connection to concrete role and database even if do not write is explicitely.
The are generally two types of connection:
- local - Unix-domain sockets
- host - using TCP/IP connection
If you don't know which you are using, then it's local. To use TCP/IP connection you need to specify -h option with target IP where postmaster is listening. For example you can add -h localhost or -h 127.0.0.1, but check your listen_adresses (AFAIK default value is localhost, so it's ok) property in postgresql.conf and accepted client IP-address(es) in HBA.
http://www.postgresql.org/docs/9.0/static/auth-pg-hba-conf.html