Linux

Setting PostgreSQL Authentication Method to MD5

Once again, we acquired another rental server with pre-installed postgreSQL. I have created a superuser immediately by invoking these commands:

su
su - postgres
psql
create role new_root SUPERUSER PASSWORD 'thePass';
q
exit
exit

However, our supervisor has created a password for some reason to postgres username. After several tries, I can’t login to phpPgAdmin using my new_root account. I also tried to access all types of account, my postgres username, my new_root username and the rest of the superusers I’ve created in ssh, but still I can’t login.

I end up setting again the authentication to trust. Login as postgres! OMG! It won’t let me login. I tried the new_root username, it logs in.

So here I go now. Since this new_root is a superuser, I can reset the postgres account.

su
su - postgres
psql -d postgres -U new_root -W
# at the psql shell
alter user postgres with password 'thePass'; 
q
exit
exit

After all those ssh thing, I tried again to login in phpPgAdmin. It still don’t work. Tried at ssh, still can’t login. It seems that I can login only if my auth was set to trust, but that would risk our data security. Trying hard to solve this, I set the auth method from ident to md5.

Everything was fine now!

By the way, PostgreSQL version is 8.1 so I don’t know if ident problem exists in the current 8.3 version. On the other server, where we are installing 8.3, we have no problem with ident authentication.

I checked the file /var/lib/pgsql/data/pg_ident.conf and check the mapping. It has no mapping indicated. That may be the problem, but I don’t have time to mess around again with mapping ident. I’m happy with md5. 🙂

Leave a reply

Your email address will not be published. Required fields are marked *