From: | aklaver(at)comcast(dot)net (Adrian Klaver) |
---|---|
To: | "Matthew Pettis" <matthew(dot)pettis(at)gmail(dot)com> |
Cc: | "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>, "Craig Ringer" <craig(at)postnewspapers(dot)com(dot)au>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Fwd: Restarting with pg_ctl, users, and passwords. |
Date: | 2008-08-20 20:56:12 |
Message-ID: | 082020082056.11954.48AC84EC0008C6E200002EB222007610649D0A900E04050E@comcast.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
-------------- Original message ----------------------
From: "Matthew Pettis" <matthew(dot)pettis(at)gmail(dot)com>
> Below is the pg_hba.conf file exerpt (minus a lot of comments)... the
> line starting '#host' was my attempt at opening up the db as wide as
> possible just to see if i could get in somehow...
>
>
> --- pg_hba.conf --------------------------------------
> # Database administrative login by UNIX sockets
> local all postgres ident sameuser
The line above is the reason you have to specify localhost in your connection string.
From:
http://www.postgresql.org/docs/8.3/interactive/auth-pg-hba-conf.html
Each record specifies a connection type, a client IP address range (if relevant for the connection type), a database name, a user name, and the authentication method to be used for connections matching these parameters. The first record with a matching connection type, client address, requested database, and user name is used to perform authentication. There is no "fall-through" or "backup": if one record is chosen and the authentication fails, subsequent records are not considered. If no record matches, access is denied.
Unless you are logged in as the OS user postgres and connecting as such the local line will fail and the connection will be aborted. To skip over the local line and get the host line you have specify localhost in your connection string.
>
> # TYPE DATABASE USER CIDR-ADDRESS METHOD
>
> # "local" is for Unix domain socket connections only
> local all all ident sameuser
> # IPv4 local connections:
> host all all 127.0.0.1/32 md5
> #host all all 127.0.0.1/32 trust
> # IPv6 local connections:
> host all all ::1/128 md5
> --------------------------------------------------------------------------------
> ----------
>
> On Wed, Aug 20, 2008 at 3:32 PM, Adrian Klaver <aklaver(at)comcast(dot)net> wrote:
> > -------------- Original message ----------------------
> > From: "Matthew Pettis" <matthew(dot)pettis(at)gmail(dot)com>
> >> SOLVED.
> >>
> >> Yep, Restart was done.
> >>
> >> The issue turned out not to be with Postgresql config, but the app
> >> config. In the app, I define a connection string, which has user,
> >> password, and databasename. When I had this same configuration on
> >> WinXP, I did not need to specify a fourth parameter, the host, which
> >> explicitly told the app to use host=localhost. When I added the host
> >> param to the connection string, it all went through.
> >>
> >> On the bright side, I learned a lot about how to restart the service
> >> and the config files...
> >>
> >> Curious: Any ideas why I can leave the host off my connection string
> >> in WinXP, but not Linux? It it an idiosyncracy of my app, or of
> >> PostgreSQL?
> >>
> >> Thanks for all the help,
> >> Matt
> >>
> > Is the Linux app running on the Postgres server machine?
> > If so I hazard a guess that you have a line like:
> >
> > local all all trust
> >
> > before your host line in pg_hba.
> >
> > The app connecting from the same machine would try the local socket (local)
> before the localhost(tcp/ip), unless localhost was specified in the connection
> string.
> >
> >
> >
> > --
> > Adrian Klaver
> > aklaver(at)comcast(dot)net
> >
> >
> >
>
>
--
Adrian Klaver
aklaver(at)comcast(dot)net
From | Date | Subject | |
---|---|---|---|
Next Message | Matthew Pettis | 2008-08-20 21:05:10 | Re: Fwd: Restarting with pg_ctl, users, and passwords. |
Previous Message | Adrian Klaver | 2008-08-20 20:48:48 | Re: Fwd: Restarting with pg_ctl, users, and passwords. |