How can you enable the login for heo?

I get the following

alt text

The problem seems to be in permissions for the user/role "heo" and probably in pg_hba.conf.

I put the following line to the file unsuccessfully

local   all         heo                          ident sameuser
link|improve this question

feedback

1 Answer

up vote 2 down vote accepted

"local" Means this is a local connection via the unix socket, rather than over the network. So if you give a hostname to connect to, this line won't work. The "ident sameuser" section means that it relies on the unix user being the same as the postgres user. If your web server is running as a different user that heo, then you won't be able to connect.

You probably want a line like:

host    all         heo         192.168.0.0/24         md5

if you're connecting over a network. Change your IP address to the right value for your network.

You can find out more information using my nicely written article on PostgreSQL authentication.

link|improve this answer
My Apache (postmaster) is running as Postgres. All these users are in this computer which I now use. I have managed to create the user masi such that the user can put data to the folder /var/www/. I would like to have do the same with heo, since heo has a database heo with SUPERUSER in this computer. I also run sudo adduser heo such that I login as him by su heo. However, I cannot run psql --password '123' for him, since I get Authentication failure. – Masi Aug 17 '09 at 19:03
excuse me for saying so, but running apache as the postgres superuser sounds like a completely insane thing to do. WTH would you do something like that? if you don't understand how postgres authentication works, that should be a motivation to learn it, not work around it with security-destroying kludges. David's article that he mentions above is a good looking intro to the topic. – Craig Sanders Aug 18 '09 at 5:35
I think Masi is confused, as they say Apache and then put postmaster, the postgresql daemon in brackets. Masi, add the line I gave to your pg_hba.conf, reload postgresql and then configure your PHP to connect with a hostname, username and password and then you can have postgresql running as postgres and your apache as www-data and you don't need a third user. – David Pashley Aug 18 '09 at 7:09
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.