Thread: Windows pgpass Problems..
I have been stuggling all day with the pgpass ability on 8.0 Postgres - on Windows 2000. I have been to the documentation:<http://www.postgresql.org/docs/8.0/interactive/libpq-pgpass.html>After reading many threads on similar problems,I just cannot seem to get a batch file to recognize that pgpass is there. I have dropped it into the Applicationdata directory postgresql\pgpass.conf of 'Administrator', (My windows username), 'postgres', 'All Users', etc,etc. The contents I have tried for the pgpass file areeach of the combinations of: localhost:5432:<mydbname>:<dbusername>:<the password> 127.0.0.1:5432:<mydbname>:<dbusername>:<the password> localhost:*:<mydbname>:<dbusername>:<the password> 127.0.0.1:*:<mydbname>:<dbusername>:<the password> ..and many others <dbusername> has been postgres and other test superuser accounts. Nothing seems to work. I have restarted postgres, restartedwindows, and it simply wont take.. Regards, Eric Emerton
> I have been stuggling all day with the pgpass ability on 8.0 Postgres - on Windows 2000. I have been to the documentation:<http://www.postgresql.org/docs/8.0/interactive/libpq-pgpass.html>After reading many threads on similar problems,I just cannot seem to get a batch file to recognize that pgpass is there. I have dropped it into the Applicationdata directory postgresql\pgpass.conf of 'Administrator', (My windows username), 'postgres', 'All Users', etc,etc. The contents I have tried for the pgpass file areeach of the combinations of: > > localhost:5432:<mydbname>:<dbusername>:<the password> > 127.0.0.1:5432:<mydbname>:<dbusername>:<the password> > localhost:*:<mydbname>:<dbusername>:<the password> > 127.0.0.1:*:<mydbname>:<dbusername>:<the password> > ..and many others > > <dbusername> has been postgres and other test superuser accounts. Nothing seems to work. I have restarted postgres,restarted windows, and it simply wont take.. > > Regards, > Eric Emerton >
Right, I found where %APPDATA% was through all the other posts (including yours I believe) - but nevertheless dropping thepgpass.conf into ALL of the %APPDATA% areas - 'All Users', 'postgres' (windows user, just in case), 'emertone' (my machineid), 'Administrator' - none of them seem to take the fact that pgpass.conf is sitting there. Eric -----Original Message----- From: Lane Van Ingen [mailto:lvaningen@esncc.com] Sent: Tuesday, September 06, 2005 1:13 PM To: Eric Emerton; pgsql-admin@postgresql.org Subject: RE: [ADMIN] Windows pgpass Problems.. Eric, I will be interested to see someone's response to your message, because I am having the same problem (in Windows 2003, version 8.0). I want to use it in a batch file that invokes psql to load a database, etc. without prompting for a password. I have not tried to use wildcards (defeats the purpose of what I am doing), but have used the specific values for hostname:port:database:user:password, with no luck. I (initially) did not know where %appdata%\postgresql should be; be sure your pgpass.conf file is in the right place. You can find it by using this command at the DOS command prompt: echo %appdata% -----Original Message----- From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org]On Behalf Of Eric Emerton Sent: Tuesday, September 06, 2005 11:25 AM To: pgsql-admin@postgresql.org Subject: [ADMIN] Windows pgpass Problems.. I have been stuggling all day with the pgpass ability on 8.0 Postgres - on Windows 2000. I have been to the documentation:<http://www.postgresql.org/docs/8.0/interactive/libpq-pgpass.h tml> After reading many threads on similar problems, I just cannot seem to get a batch file to recognize that pgpass is there. I have dropped it into the Application data directory postgresql\pgpass.conf of 'Administrator', (My windows username), 'postgres', 'All Users', etc, etc. The contents I have tried for the pgpass file areeach of the combinations of: localhost:5432:<mydbname>:<dbusername>:<the password> 127.0.0.1:5432:<mydbname>:<dbusername>:<the password> localhost:*:<mydbname>:<dbusername>:<the password> 127.0.0.1:*:<mydbname>:<dbusername>:<the password> ..and many others <dbusername> has been postgres and other test superuser accounts. Nothing seems to work. I have restarted postgres, restarted windows, and it simply wont take.. Regards, Eric Emerton ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org
Eric, I will be interested to see someone's response to your message, because I am having the same problem (in Windows 2003, version 8.0). I want to use it in a batch file that invokes psql to load a database, etc. without prompting for a password. I have not tried to use wildcards (defeats the purpose of what I am doing), but have used the specific values for hostname:port:database:user:password, with no luck. I (initially) did not know where %appdata%\postgresql should be; be sure your pgpass.conf file is in the right place. You can find it by using this command at the DOS command prompt: echo %appdata% -----Original Message----- From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org]On Behalf Of Eric Emerton Sent: Tuesday, September 06, 2005 11:25 AM To: pgsql-admin@postgresql.org Subject: [ADMIN] Windows pgpass Problems.. I have been stuggling all day with the pgpass ability on 8.0 Postgres - on Windows 2000. I have been to the documentation:<http://www.postgresql.org/docs/8.0/interactive/libpq-pgpass.h tml> After reading many threads on similar problems, I just cannot seem to get a batch file to recognize that pgpass is there. I have dropped it into the Application data directory postgresql\pgpass.conf of 'Administrator', (My windows username), 'postgres', 'All Users', etc, etc. The contents I have tried for the pgpass file areeach of the combinations of: localhost:5432:<mydbname>:<dbusername>:<the password> 127.0.0.1:5432:<mydbname>:<dbusername>:<the password> localhost:*:<mydbname>:<dbusername>:<the password> 127.0.0.1:*:<mydbname>:<dbusername>:<the password> ..and many others <dbusername> has been postgres and other test superuser accounts. Nothing seems to work. I have restarted postgres, restarted windows, and it simply wont take.. Regards, Eric Emerton ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org
Lane I may have found the problem (or at least a way around it) - through another thread search. The file: C:\Program Files\PostgreSQL\<your version>\data\pg_hba.conf ..has general connection info for hitting postgres. Mine looked like: # TYPE DATABASE USER CIDR-ADDRESS METHOD local all all md5 # IPv4-style local connections: host all all 127.0.0.1/32 md5 : etc. I changed the 'md5's to 'trust' for local connections, and the prompting for Password during a .bat batch run of a backupstopped working. I'm a bit of a Postgres rookie, so I'm not sure the ramifications of changing this to 'trust' ona more global security level. Eric -----Original Message----- From: Lane Van Ingen [mailto:lvaningen@esncc.com] Sent: Tuesday, September 06, 2005 1:13 PM To: Eric Emerton; pgsql-admin@postgresql.org Subject: RE: [ADMIN] Windows pgpass Problems.. Eric, I will be interested to see someone's response to your message, because I am having the same problem (in Windows 2003, version 8.0). I want to use it in a batch file that invokes psql to load a database, etc. without prompting for a password. I have not tried to use wildcards (defeats the purpose of what I am doing), but have used the specific values for hostname:port:database:user:password, with no luck. I (initially) did not know where %appdata%\postgresql should be; be sure your pgpass.conf file is in the right place. You can find it by using this command at the DOS command prompt: echo %appdata% -----Original Message----- From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org]On Behalf Of Eric Emerton Sent: Tuesday, September 06, 2005 11:25 AM To: pgsql-admin@postgresql.org Subject: [ADMIN] Windows pgpass Problems.. I have been stuggling all day with the pgpass ability on 8.0 Postgres - on Windows 2000. I have been to the documentation:<http://www.postgresql.org/docs/8.0/interactive/libpq-pgpass.h tml> After reading many threads on similar problems, I just cannot seem to get a batch file to recognize that pgpass is there. I have dropped it into the Application data directory postgresql\pgpass.conf of 'Administrator', (My windows username), 'postgres', 'All Users', etc, etc. The contents I have tried for the pgpass file areeach of the combinations of: localhost:5432:<mydbname>:<dbusername>:<the password> 127.0.0.1:5432:<mydbname>:<dbusername>:<the password> localhost:*:<mydbname>:<dbusername>:<the password> 127.0.0.1:*:<mydbname>:<dbusername>:<the password> ..and many others <dbusername> has been postgres and other test superuser accounts. Nothing seems to work. I have restarted postgres, restarted windows, and it simply wont take.. Regards, Eric Emerton ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org
I am relatively new to PostgreSQL too, so we are sharing the same boat :-) Will try it, it will get me by a big problem temporarily, but hopefully somebody will answer why the 'recommended way' does not (appear) to work. As it turns out, this would work for me, so long as I copy in another pg_hba.conf file later in the batch file that closes up the security hole I may be opening by saying 'trust'. -----Original Message----- From: Eric Emerton [mailto:Eric.Emerton@etrials.com] Sent: Tuesday, September 06, 2005 1:34 PM To: Lane Van Ingen; pgsql-admin@postgresql.org Subject: RE: [ADMIN] Windows pgpass Problems.. Lane I may have found the problem (or at least a way around it) - through another thread search. The file: C:\Program Files\PostgreSQL\<your version>\data\pg_hba.conf ..has general connection info for hitting postgres. Mine looked like: # TYPE DATABASE USER CIDR-ADDRESS METHOD local all all md5 # IPv4-style local connections: host all all 127.0.0.1/32 md5 : etc. I changed the 'md5's to 'trust' for local connections, and the prompting for Password during a .bat batch run of a backup stopped working. I'm a bit of a Postgres rookie, so I'm not sure the ramifications of changing this to 'trust' on a more global security level. Eric -----Original Message----- From: Lane Van Ingen [mailto:lvaningen@esncc.com] Sent: Tuesday, September 06, 2005 1:13 PM To: Eric Emerton; pgsql-admin@postgresql.org Subject: RE: [ADMIN] Windows pgpass Problems.. Eric, I will be interested to see someone's response to your message, because I am having the same problem (in Windows 2003, version 8.0). I want to use it in a batch file that invokes psql to load a database, etc. without prompting for a password. I have not tried to use wildcards (defeats the purpose of what I am doing), but have used the specific values for hostname:port:database:user:password, with no luck. I (initially) did not know where %appdata%\postgresql should be; be sure your pgpass.conf file is in the right place. You can find it by using this command at the DOS command prompt: echo %appdata% -----Original Message----- From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org]On Behalf Of Eric Emerton Sent: Tuesday, September 06, 2005 11:25 AM To: pgsql-admin@postgresql.org Subject: [ADMIN] Windows pgpass Problems.. I have been stuggling all day with the pgpass ability on 8.0 Postgres - on Windows 2000. I have been to the documentation:<http://www.postgresql.org/docs/8.0/interactive/libpq-pgpass.h tml> After reading many threads on similar problems, I just cannot seem to get a batch file to recognize that pgpass is there. I have dropped it into the Application data directory postgresql\pgpass.conf of 'Administrator', (My windows username), 'postgres', 'All Users', etc, etc. The contents I have tried for the pgpass file areeach of the combinations of: localhost:5432:<mydbname>:<dbusername>:<the password> 127.0.0.1:5432:<mydbname>:<dbusername>:<the password> localhost:*:<mydbname>:<dbusername>:<the password> 127.0.0.1:*:<mydbname>:<dbusername>:<the password> ..and many others <dbusername> has been postgres and other test superuser accounts. Nothing seems to work. I have restarted postgres, restarted windows, and it simply wont take.. Regards, Eric Emerton ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org
I believe the problem is that under Windows there is no such entity as $HOME. -----Original Message----- From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Lane Van Ingen Sent: Tuesday, September 06, 2005 1:55 PM To: Eric Emerton; pgsql-admin@postgresql.org Subject: Re: [ADMIN] Windows pgpass Problems.. I am relatively new to PostgreSQL too, so we are sharing the same boat :-) Will try it, it will get me by a big problem temporarily, but hopefully somebody will answer why the 'recommended way' does not (appear) to work. As it turns out, this would work for me, so long as I copy in another pg_hba.conf file later in the batch file that closes up the security hole I may be opening by saying 'trust'. -----Original Message----- From: Eric Emerton [mailto:Eric.Emerton@etrials.com] Sent: Tuesday, September 06, 2005 1:34 PM To: Lane Van Ingen; pgsql-admin@postgresql.org Subject: RE: [ADMIN] Windows pgpass Problems.. Lane I may have found the problem (or at least a way around it) - through another thread search. The file: C:\Program Files\PostgreSQL\<your version>\data\pg_hba.conf ..has general connection info for hitting postgres. Mine looked like: # TYPE DATABASE USER CIDR-ADDRESS METHOD local all all md5 # IPv4-style local connections: host all all 127.0.0.1/32 md5 : etc. I changed the 'md5's to 'trust' for local connections, and the prompting for Password during a .bat batch run of a backup stopped working. I'm a bit of a Postgres rookie, so I'm not sure the ramifications of changing this to 'trust' on a more global security level. Eric -----Original Message----- From: Lane Van Ingen [mailto:lvaningen@esncc.com] Sent: Tuesday, September 06, 2005 1:13 PM To: Eric Emerton; pgsql-admin@postgresql.org Subject: RE: [ADMIN] Windows pgpass Problems.. Eric, I will be interested to see someone's response to your message, because I am having the same problem (in Windows 2003, version 8.0). I want to use it in a batch file that invokes psql to load a database, etc. without prompting for a password. I have not tried to use wildcards (defeats the purpose of what I am doing), but have used the specific values for hostname:port:database:user:password, with no luck. I (initially) did not know where %appdata%\postgresql should be; be sure your pgpass.conf file is in the right place. You can find it by using this command at the DOS command prompt: echo %appdata% -----Original Message----- From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org]On Behalf Of Eric Emerton Sent: Tuesday, September 06, 2005 11:25 AM To: pgsql-admin@postgresql.org Subject: [ADMIN] Windows pgpass Problems.. I have been stuggling all day with the pgpass ability on 8.0 Postgres - on Windows 2000. I have been to the documentation:<http://www.postgresql.org/docs/8.0/interactive/libpq-pgpa ss.h tml> After reading many threads on similar problems, I just cannot seem to get a batch file to recognize that pgpass is there. I have dropped it into the Application data directory postgresql\pgpass.conf of 'Administrator', (My windows username), 'postgres', 'All Users', etc, etc. The contents I have tried for the pgpass file areeach of the combinations of: localhost:5432:<mydbname>:<dbusername>:<the password> 127.0.0.1:5432:<mydbname>:<dbusername>:<the password> localhost:*:<mydbname>:<dbusername>:<the password> 127.0.0.1:*:<mydbname>:<dbusername>:<the password> ..and many others <dbusername> has been postgres and other test superuser accounts. Nothing seems to work. I have restarted postgres, restarted windows, and it simply wont take.. Regards, Eric Emerton ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq
On Tue, Sep 06, 2005 at 11:24:45AM -0400, Eric Emerton wrote: > I have been stuggling all day with the pgpass ability on 8.0 Postgres > - on Windows 2000. I have been to the > documentation:<http://www.postgresql.org/docs/8.0/interactive/libpq-pgpass.html> > After reading many threads on similar problems, I just cannot seem to > get a batch file to recognize that pgpass is there. I have dropped > it into the Application data directory postgresql\pgpass.conf of > 'Administrator', (My windows username), 'postgres', 'All Users', etc, > etc. The contents I have tried for the pgpass file areeach of the > combinations of: > > localhost:5432:<mydbname>:<dbusername>:<the password> > 127.0.0.1:5432:<mydbname>:<dbusername>:<the password> > localhost:*:<mydbname>:<dbusername>:<the password> > 127.0.0.1:*:<mydbname>:<dbusername>:<the password> > ..and many others > > <dbusername> has been postgres and other test superuser accounts. > Nothing seems to work. I have restarted postgres, restarted windows, > and it simply wont take.. Which program fails, and how does it fail? You have the correct permissions on the file, I presume? The file should not be readable nor writable by anyone but the owner; and I assume the directory where it resides, shouldn't either (In fact I'd check every directory up in the path.) -- Alvaro Herrera -- Valdivia, Chile Architect, www.EnterpriseDB.com "Entristecido, Wutra (canción de Las Barreras) echa a Freyr a rodar y a nosotros al mar"
On Tue, 2005-09-06 at 10:24, Eric Emerton wrote: > I have been stuggling all day with the pgpass ability on 8.0 Postgres - on Windows 2000. I have been to the documentation:<http://www.postgresql.org/docs/8.0/interactive/libpq-pgpass.html>After reading many threads on similar problems,I just cannot seem to get a batch file to recognize that pgpass is there. I have dropped it into the Applicationdata directory postgresql\pgpass.conf of 'Administrator', (My windows username), 'postgres', 'All Users', etc,etc. The contents I have tried for the pgpass file areeach of the combinations of: > > localhost:5432:<mydbname>:<dbusername>:<the password> > 127.0.0.1:5432:<mydbname>:<dbusername>:<the password> > localhost:*:<mydbname>:<dbusername>:<the password> > 127.0.0.1:*:<mydbname>:<dbusername>:<the password> > ..and many others > > <dbusername> has been postgres and other test superuser accounts. Nothing seems to work. I have restarted postgres,restarted windows, and it simply wont take.. Has it been set to be readable only by the given user who is using it?