X-Original-To: pgsql-general@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id AA1D8476141 for ; Wed, 7 May 2003 12:45:38 -0400 (EDT) Received: from kronos.honk.org (kronos.honk.org [206.191.41.253]) by postgresql.org (Postfix) with ESMTP id 4B1FD4763CE for ; Wed, 7 May 2003 12:45:32 -0400 (EDT) Received: from kronos.honk.org (localhost [127.0.0.1]) by kronos.honk.org (8.12.3/8.12.3) with ESMTP id h47GZhQC025623 for ; Wed, 7 May 2003 12:35:43 -0400 Received: from localhost (jearle@localhost) by kronos.honk.org (8.12.3/8.12.3/Debian-6.3) with ESMTP id h47GZhGZ025619 for ; Wed, 7 May 2003 12:35:43 -0400 Date: Wed, 7 May 2003 12:35:43 -0400 (EDT) From: Jon Earle To: pgsql-general@postgresql.org Subject: PostgreSQL Qs Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Status: No, hits=-12.3 required=5.0 tests=BAYES_01,USER_AGENT_PINE autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/206 X-Sequence-Number: 41861 Hey folks, I've been trying to figure out the user authentication stuff in PostgreSQL, and am finding it more confusing than mysql. My system runs Debian, I installed postgresql from apt. It seemed to proceed correctly (no errors were tossed my way). As user postgres, I created the db and table structure. Again, seemed to proceed correctly. I changed /etc/postgresql/pg_hba.conf to: local all md5 host all 127.0.0.1 255.0.0.0 md5 host dbname 0.0.0.0 255.255.255.255 md5 Then, I went to add the DBD-Pg module for Perl (compiled from scratch). I set the env vars: export DBI_DSN=dbi:Pg:dbname=template1 export DBI_USER=postgres export DBI_PASS=xxxxxx Then I ran 'make test'. I got a lot of: .. t/99cleanup.........DBI connect('dbname=template1','postgres',...) failed: FATAL 1: Password authentication failed for user "postgres" at t/99cleanup.t line 11 .. Changing AUTH_TYPE from 'md5' to 'password' gives the same error. The only way I can get anything to run (the test scripts or the script below) is to change the AUTH_TYPE to 'trust' (Note: I can run the script below as user postgres if I leave the AUTH_TYPE and AUTH_ARGUMENT as the default values [ident and sameuser], but, since I don't run an ident server, this doesn't make sense to me.) Obviously, I don't want to leave the AUTH_TYPE as trust, but I'm not sure what I need to do to get a username/password combo to work (particularly within a perl script using DBI [When I tested this using mysql, I had it working and found it much simpler]. Could someone explain or give me a link to a doc that explains what is going on as far as user authentication is concerned? Actually, a basic howto guide for PGSQL would be most helpful for many things. Cheers! Jon Test Script (from O'Reilly's Programming the Perl DBI): #!/usr/bin/perl -w use DBI; my @drivers = DBI->available_drivers(); die "No drivers.\n" unless @drivers; foreach my $driver (@drivers) { print "Driver: $driver\n"; my @datasources = DBI->data_sources($driver); foreach my $datasource (@datasources) { print "\tData source is $datasource\n"; } print "\n"; } exit;