Thread: problems logging in through phpPgAdmin
We are using phpPgAdmin 4.2.3 on Redhat Linux 5 to access local postgres 8.4 databases and some remote postgres 8.0 and 7.4 databases. If I set the pg_hba.conf settings to “trust” I can login to phpPgAdmin with any password at all or with no password at all. If I change the “trust” to “md5” I get “Login Failed” errors on every login (we always login as postgres), even though the password is correct. When this happens I check the log in pg_log folder, and all it says is “FATAL: password authentication failed for user "postgres"”. In the phpPgAdmin config.inc.php file, we have this setting:
$conf['extra_login_security'] = false;
We are not having any problems logging into the databases from the command line.
Thanks in advance for any suggestions.
Julie
julie.davenport@ctcd.edu
On Sep 26, 2011, at 10:16 AM, Davenport, Julie wrote: > We are using phpPgAdmin 4.2.3 on Redhat Linux 5 to access local postgres 8.4 databases and some remote postgres 8.0 and7.4 databases. If I set the pg_hba.conf settings to “trust” I can login to phpPgAdmin with any password at all or withno password at all. If I change the “trust” to “md5” I get “Login Failed” errors on every login (we always login aspostgres), even though the password is correct. When this happens I check the log in pg_log folder, and all it says is“FATAL: password authentication failed for user "postgres"”. In the phpPgAdmin config.inc.php file, we have this setting: > $conf['extra_login_security'] = false; > We are not having any problems logging into the databases from the command line. Is the pg_hba.conf line where you changed "trust" to "md5" host or local? I think phpPgAdmin uses only host connections. John DeSoi, Ph.D.
On Sep 26, 2011, at 2:19 PM, Davenport, Julie wrote: > If I use this combination: > local all all trust > host all all 127.0.0.1/32 md5 > or this: > local all all md5 > host all all 127.0.0.1/32 md5 > > then we cannot login at all -- even if we put in the correct password, we get "Login Failed" on the screen, and we justsee " FATAL: password authentication failed for user "postgres"" in the log under pg_log. And you say you tested psql from the command line like this psql -U postgres -h 127.0.0.1 and it prompts you for the password and accepts the one you are entering with phpPgAdmin? And PHP is running on the same server as Postgres? What is the IP address used in your phpPgAdmin configuration? If it is not 127.0.0.1, you might need to use the explicitIP address in your pg_hba.conf. Best, John DeSoi, Ph.D.
On Sep 26, 2011, at 3:16 PM, Davenport, Julie wrote: > psql srn_mst > > and it will get me into the database whether I have the line set to trust or md5. And does not ask for a password eitherway (never does). This is how I always access the database from the command line. Right, because you are trusting local connections and that is what is used because there is no -h option provided. > When I tried the way you suggested: > > psql -U postgres -h 127.0.0.1 -d srn_mst > > if set to trust, this logs me in (does not ask for password of course). > If set to md5, this command asks me for password, but when I put it in, gives me this error: > psql: FATAL: password authentication failed for user "postgres" > (same as what is happening through the application). Which means that you don't really know the postgres password :). If you can't access postgres this way, it is not going towork with phpPgAdmin either. You can login using the local connection and then change the postgres password. > > Yes, PHP and phpPgAdmin and postgresql are all running on the same linux server (where this database srn_mst resides). > > This is the enry in my phppgadmin conf file config.inc.php for this server: > // Soarapp > $conf['servers'][3]['desc'] = 'Soarapp'; > $conf['servers'][3]['host'] = 'localhost'; > $conf['servers'][3]['port'] = 5432; > $conf['servers'][3]['defaultdb'] = 'template1'; > $conf['servers'][3]['pg_dump_path'] = '/usr/bin/pg_dump'; > $conf['servers'][3]['pg_dumpall_path'] = '/usr/bin/pg_dumpall'; > Not sure if that is what your question refers to... > I was referring to the "host" setting. If you get the password fixed where it works with psql and it still does not workwith phpPgAdmin, try changing the host setting to 127.0.0.1. John DeSoi, Ph.D.
This is what is in our pg_hba.conf file now, and it lets us login with no password or wrong password: # TYPE DATABASE USER CIDR-ADDRESS METHOD # "local" is for Unix domain socket connections only local all all trust # IPv4 local connections: host all all 127.0.0.1/32 trust host srn_mst postgres <IP of remote server1> 255.255.255.255 trust host debase postgres <IP of remote server2> 255.255.255.255 trust host all all <IP of local server> 255.255.255.255 md5 # IPv6 local connections: host all all ::1/128 ident host all all 127.0.0.1/32 trust -bash-3.2$ If I use this combination: local all all md5 host all all 127.0.0.1/32 trust same thing - we can login with no password or wrong password If I use this combination: local all all trust host all all 127.0.0.1/32 md5 or this: local all all md5 host all all 127.0.0.1/32 md5 then we cannot login at all -- even if we put in the correct password, we get "Login Failed" on the screen, and we just see" FATAL: password authentication failed for user "postgres"" in the log under pg_log. I also changed this line from trust to md5: host all all <IP of local server> 255.255.255.255 md5 and as long as the line above host all all 127.0.0.1/32 trust is trust we can get in, and if it is md5, we cannot (in other words, it seems to override the line with the actual IP ofthe local server). Julie A. Davenport Senior Systems Engineer Distance Education & Educational Technology Central Texas College 254-526-1798 julie.davenport@ctcd.edu -----Original Message----- From: John DeSoi [mailto:desoi@pgedit.com] Sent: Monday, September 26, 2011 12:44 PM To: Davenport, Julie Cc: pgsql-admin@postgresql.org Subject: Re: [ADMIN] problems logging in through phpPgAdmin On Sep 26, 2011, at 10:16 AM, Davenport, Julie wrote: > We are using phpPgAdmin 4.2.3 on Redhat Linux 5 to access local postgres 8.4 databases and some remote postgres 8.0 and7.4 databases. If I set the pg_hba.conf settings to "trust" I can login to phpPgAdmin with any password at all or withno password at all. If I change the "trust" to "md5" I get "Login Failed" errors on every login (we always login aspostgres), even though the password is correct. When this happens I check the log in pg_log folder, and all it says is"FATAL: password authentication failed for user "postgres"". In the phpPgAdmin config.inc.php file, we have this setting: > $conf['extra_login_security'] = false; > We are not having any problems logging into the databases from the command line. Is the pg_hba.conf line where you changed "trust" to "md5" host or local? I think phpPgAdmin uses only host connections. John DeSoi, Ph.D.
Sorry, when I said we had no trouble getting in from the command line, I meant that I could do the following to get intodatabase named srn_mst (after su-ing to postgres user): psql srn_mst and it will get me into the database whether I have the line set to trust or md5. And does not ask for a password eitherway (never does). This is how I always access the database from the command line. When I tried the way you suggested: psql -U postgres -h 127.0.0.1 -d srn_mst if set to trust, this logs me in (does not ask for password of course). If set to md5, this command asks me for password, but when I put it in, gives me this error: psql: FATAL: password authentication failed for user "postgres" (same as what is happening through the application). Yes, PHP and phpPgAdmin and postgresql are all running on the same linux server (where this database srn_mst resides). This is the enry in my phppgadmin conf file config.inc.php for this server: // Soarapp $conf['servers'][3]['desc'] = 'Soarapp'; $conf['servers'][3]['host'] = 'localhost'; $conf['servers'][3]['port'] = 5432; $conf['servers'][3]['defaultdb'] = 'template1'; $conf['servers'][3]['pg_dump_path'] = '/usr/bin/pg_dump'; $conf['servers'][3]['pg_dumpall_path'] = '/usr/bin/pg_dumpall'; Not sure if that is what your question refers to... Thanks.... Julie -----Original Message----- From: John DeSoi [mailto:desoi@pgedit.com] Sent: Monday, September 26, 2011 1:58 PM To: Davenport, Julie Cc: pgsql-admin@postgresql.org; Hussey, Latasha Subject: Re: [ADMIN] problems logging in through phpPgAdmin On Sep 26, 2011, at 2:19 PM, Davenport, Julie wrote: > If I use this combination: > local all all trust > host all all 127.0.0.1/32 md5 > or this: > local all all md5 > host all all 127.0.0.1/32 md5 > > then we cannot login at all -- even if we put in the correct password, we get "Login Failed" on the screen, and we justsee " FATAL: password authentication failed for user "postgres"" in the log under pg_log. And you say you tested psql from the command line like this psql -U postgres -h 127.0.0.1 and it prompts you for the password and accepts the one you are entering with phpPgAdmin? And PHP is running on the same server as Postgres? What is the IP address used in your phpPgAdmin configuration? If it is not 127.0.0.1, you might need to use the explicitIP address in your pg_hba.conf. Best, John DeSoi, Ph.D.
OK, I see what you are saying. I guess we need to reset the password of the postgres user inside the database. I'm outof the office but will try this next week when I'm back in. Thanks much for your help. Julie ________________________________________ From: John DeSoi [desoi@pgedit.com] Sent: Monday, September 26, 2011 3:06 PM To: Davenport, Julie Cc: pgsql-admin@postgresql.org; Hussey, Latasha Subject: Re: [ADMIN] problems logging in through phpPgAdmin On Sep 26, 2011, at 3:16 PM, Davenport, Julie wrote: > psql srn_mst > > and it will get me into the database whether I have the line set to trust or md5. And does not ask for a password eitherway (never does). This is how I always access the database from the command line. Right, because you are trusting local connections and that is what is used because there is no -h option provided. > When I tried the way you suggested: > > psql -U postgres -h 127.0.0.1 -d srn_mst > > if set to trust, this logs me in (does not ask for password of course). > If set to md5, this command asks me for password, but when I put it in, gives me this error: > psql: FATAL: password authentication failed for user "postgres" > (same as what is happening through the application). Which means that you don't really know the postgres password :). If you can't access postgres this way, it is not going towork with phpPgAdmin either. You can login using the local connection and then change the postgres password. > > Yes, PHP and phpPgAdmin and postgresql are all running on the same linux server (where this database srn_mst resides). > > This is the enry in my phppgadmin conf file config.inc.php for this server: > // Soarapp > $conf['servers'][3]['desc'] = 'Soarapp'; > $conf['servers'][3]['host'] = 'localhost'; > $conf['servers'][3]['port'] = 5432; > $conf['servers'][3]['defaultdb'] = 'template1'; > $conf['servers'][3]['pg_dump_path'] = '/usr/bin/pg_dump'; > $conf['servers'][3]['pg_dumpall_path'] = '/usr/bin/pg_dumpall'; > Not sure if that is what your question refers to... > I was referring to the "host" setting. If you get the password fixed where it works with psql and it still does not workwith phpPgAdmin, try changing the host setting to 127.0.0.1. John DeSoi, Ph.D.