Thread: authentication failed
Why happens this? Warning: pg_connect() unable to connect to PostgreSQL server: FATAL: IDENT authentication failed for user "bchytrek" in /var/www/html/physio2/test.php on line 19 The php-statement is : $conn = pg_connect("dbname=testdb user=bchytrek"); the owner of that testdb is bchytrek and he does not have a password, he is in the users-list as superuser, an may cerate dbs. So why does the authentication fail? Helpless Bogdan
Bogdan Chytrek wrote: >Why happens this? > >Warning: pg_connect() unable to connect to PostgreSQL server: FATAL: >IDENT authentication failed for user "bchytrek" in >/var/www/html/physio2/test.php on line 19 > >The php-statement is : > >$conn = pg_connect("dbname=testdb user=bchytrek"); > >the owner of that testdb is bchytrek and he does not have a password, he >is in the users-list as superuser, an may cerate dbs. > >So why does the authentication fail? > > > Check your pg_hba.conf and postgresql.conf files. I bet you forgot to turn on tcp/ip sockets, didn't you ;-) On my RedHat 9 box: -- /var/lib/pgsql/data/pg_hba.conf #TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD local all all trust host all all 0.0.0.0 0.0.0.0 trust -- /var/lib/pgsql/data/postgresql.conf tcpip_socket = true Try starting with something like THIS ... then tighten the security after you get it to start working. Dante
roboccc@t-online.de (Bogdan Chytrek) writes: > So why does the authentication fail? Because the PHP script is not running as Unix user bchytrek (most likely that process runs under some daemon userid or other). When you are using IDENT authentication, your Unix user name has to match your Postgres user name. You could possibly work around that by creating an IDENT map that allows the PHP daemon user to be accepted as bchytrek; see the admin guide for details. But more likely you'll just want to switch to a different authentication method. regards, tom lane
Hi Bogdan; This is a typical problem when you install PosgreSQL via the Red Hat CD's. You need to edit the pg_hba.conf and change the authentication type to more appropriate settings. If your PHP app connects using a host field in the connection string, it will be using a network socket. Otherwise, it will be a local socket. I usually set my servers to use md5 authentication for all network connections and trust for local connections, allowing the admin to connect locally as any user, but this assumes a level of security and architecture you may not wish to assume. md5 authentication on both local and network sockets will force password authentication for all connections via a zero-knowledge md5-sum authentication method. Best Wishes, Chris Travers ----- Original Message ----- From: "Bogdan Chytrek" <roboccc@t-online.de> To: <pgsql-general@postgresql.org> Sent: Thursday, December 18, 2003 6:26 PM Subject: [GENERAL] authentication failed Why happens this? Warning: pg_connect() unable to connect to PostgreSQL server: FATAL: IDENT authentication failed for user "bchytrek" in /var/www/html/physio2/test.php on line 19 The php-statement is : $conn = pg_connect("dbname=testdb user=bchytrek"); the owner of that testdb is bchytrek and he does not have a password, he is in the users-list as superuser, an may cerate dbs. So why does the authentication fail? Helpless Bogdan ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings