User Authentication
If you set postgres to require authentication ie in /etc/postgresql/pg_hba.conf "local all md5" then you have to make sure that you create a password for postgres otherwise you will fail to authenticate when you try do anything using the postgres user.
ie
sh-2.05b$ createuser nsadmin
Shall the new user be allowed to create databases? (y/n)
Shall the new user be allowed to create more new users? (y/n)
Password:
psql: FATAL 1: Password authentication failed for user "postgres"createuser: creation of user "nsadmin" failed
To fix this you will have to edit the pg_hba.conf file and change "local all md5" to "local all ident sameuser" and then restart postgres sudo /etc/init.d/postgres restart.
Then
sh-2.05b$ psql testdb
bric=# ALTER USER postgres WITH ENCRYPTED PASSWORD 12345qwert;
bric=# q
Then change the pg_hba.conf file back to require authentication and restart postgreql again. Now when postgres runs the "createuser" command and you enter the password at the prompt you will then be allowed to create the user.
