Source: https://gist.github.com/mahfuz10/ca860b7df347cbb36be171670ed40c07
Allow password authentication
$ sudo vim /etc/postgresql/9.5/main/pg_hba.conf
from
# TYPE DATABASE USER ADDRESS METHOD
local all all peer
to
# TYPE DATABASE USER ADDRESS METHOD
local all all md5
peer means it will trust the identity (authenticity) of UNIX user. So not asking for a password.
md5 means it will always ask for a password, and validate it after hashing with MD5.
trust means it will never ask for a password, and always trust any connection.
Restart postgresql service
$ sudo service postgresql restart