Re: [GENERAL] PostgreSQL Qs
Re: [GENERAL] PostgreSQL Qs
От:
<mallah@trade-india.com>
Дата:
Hi ,
shudn't "host" lines in pg_hba.conf be in format
host database user ip mask method
in lines below u missed the user part:
> host all 127.0.0.1 255.0.0.0 md5
> host dbname 0.0.0.0 255.255.255.255 md5
i think pg_hba.conf is pretty cool otherwise.
regds
mallah.
> 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;
>
>
> ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and
> unsubscribe commands go to majordomo@postgresql.org
-----------------------------------------
Get your free web based email at trade-india.com. "India's Leading B2B eMarketplace.!"
http://www.trade-india.com/
Re: [GENERAL] PostgreSQL Qs
От:
Robert Treat <xzilla@users.sourceforge.net>
Дата:
he's probably running 7.2.x Robert Treat On Wed, 2003-05-07 at 14:01, mallah@trade-india.com wrote: > > > Hi , > > shudn't "host" lines in pg_hba.conf be in format > host database user ip mask method > > in lines below u missed the user part: > > > host all 127.0.0.1 255.0.0.0 md5 > > host dbname 0.0.0.0 255.255.255.255 md5 > > i think pg_hba.conf is pretty cool otherwise. > > regds > mallah. > > >
Re: [GENERAL] PostgreSQL Qs
От:
Jon Earle <je_pgsql@kronos.honk.org>
Дата:
On Wed, 7 May 2003 mallah@trade-india.com wrote: > Hi , > > shudn't "host" lines in pg_hba.conf be in format > host database user ip mask method > > in lines below u missed the user part: > > > host all 127.0.0.1 255.0.0.0 md5 > > host dbname 0.0.0.0 255.255.255.255 md5 I don't believe so. From the pg_hba.conf docs: # host # ---- # # This record identifies networked hosts that are permitted to connect # via IP connections. # # Format: # # host DBNAME IP_ADDRESS ADDRESS_MASK AUTH_TYPE [AUTH_ARGUMENT] I ended up solving the problem however. With a colleague offering thoughts, we determined that there is a system table named pg_shadow that contains the usernames and passwords. Didn't see that in the docs (I was thinking a file named pg_shadow would be magically created somewhere...). Next, I'd done two things wrong with the alter user command - first, I put quotes around the username and password. Apparently, just the password needs 'em. Next, I omitted the trailing ; and failed to notice the very subtle change in the command prompt that indicated it was waiting for input. Off now to get myself further in trouble with the beast! :) Thanks for the responses! Cheers! Jon -- Jon Earle SAVE FARSCAPE http://www.savefarscape.com/ While it's okay to disagree with your friends and family, childish insults do not express sovereignty.