Re: BUG #2000: psql does not prompt for password

From: "Duncan Goodwin" <duncan_goodwin(at)yahoo(dot)ca>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2000: psql does not prompt for password
Date: 2005-12-22 18:13:55
Message-ID: 1135275235.213584.65590@g14g2000cwa.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I just installed the 8.1.1 release on Windows XP Pro and encountered a
very strange problem that seems to be related to your problem. My
pg_hba.conf is the default out-of-the-box config (i.e local IPv4
connections are configured as: host all all 127.0.0.1/32 md5). I tried
running psql from different shells, cmd.exe and 4NT, as well as using
the shortcut to cmd.exe installed by the PostgreSQL installer. In some
cases I was prompted for a password, but in other cases, psql would not
prompt me, even if I tried to force it with -W.
After several hours of testing different login users and pg_hba.conf
entries I stumbled upon this discovery: the shell doesn't matter, your
current directory does (see the transcript below). If you are
currently in a directory on a local hard drive such as C:,
authentication always fails, but if you are currently on a network
drive, in my case H:, password prompting always occurs as documented.
Prompting also occurs correctly if the drive is local but you are
mounting it as if it were a network drive (for reasons I won't go into,
my D: and E: drives are "network" mounts of subdirectories on C:).
Here is a sample session in cmd.exe:

------------------------------------------------------------------------------------------------------------------------------

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

H:\>c:

C:\>psql
psql: FATAL: password authentication failed for user "dhg0417"

C:\>psql -W
psql: FATAL: password authentication failed for user "dhg0417"

C:\>h:

H:\>psql
Password:
Welcome to psql 8.1.1, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

Warning: Console code page (437) differs from Windows code page (1252)
8-bit characters may not work correctly. See psql reference
page "Notes for Windows users" for details.

dhg0417=> \q

H:\>d:

D:\>psql
Password:
Welcome to psql 8.1.1, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

Warning: Console code page (437) differs from Windows code page (1252)
8-bit characters may not work correctly. See psql reference
page "Notes for Windows users" for details.

dhg0417=>

---------------------------------------------------------------------------------------------------------------------------

My guess is that psql treats requests while logged in to a network
drive as "network" connections, while requests from the C: drive seem
to be treated as "local" connections. Should I submit this as a bug or
is this known behaviour?

Bruce Momjian wrote:
> Mike Grant wrote:
> > I get the same thing with 8.0.4, on Windows XP Professional.
>
> I am still confused. I tried 'psql -W test' in the mingw shell window,
> and in a 'cmd.exe' window, and both prompted me for a password. I even
> tried a command.com window.
>
> Are you using a Cygwin window perhaps?
>
> ---------------------------------------------------------------------------
>
>
> >
> > ~Mike
> >
> > Bruce Momjian wrote:
> > > Todd wrote:
> > > >
> > > > The following bug has been logged online:
> > > >
> > > > Bug reference: 2000
> > > > Logged by: Todd
> > > > Email address: tdoolitt(at)comcast(dot)net
> > > > PostgreSQL version: 8.1 Beta 4
> > > > Operating system: Windows Xp home
> > > > Description: psql does not prompt for password
> > > > Details:
> > > >
> > > > psql -U postgres does not prompt for password and responds with...
> > > >
> > > > psql: FATAL: password authentication failed for user "postgres".
> > > >
> > > > even when I pass the -W option it doesn't prompt for password and gives me
> > > > the error above. I deleted and recreated my cluster and get the same
> > > > result. I can connect to the database using PgAdmin as user postgres.
> > >
> > > I have no idea what is causing this, but I have never heard of this
> > > problem before.
> > >
> > > --
> > > Bruce Momjian | http://candle.pha.pa.us
> > > pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
> > > + If your life is a hard drive, | 13 Roberts Road
> > > + Christ can be your backup. | Newtown Square, Pennsylvania 19073
> > >
> > > ---------------------------(end of broadcast)---------------------------
> > > TIP 5: don't forget to increase your free space map settings
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: don't forget to increase your free space map settings
> >
>
> --
> Bruce Momjian | http://candle.pha.pa.us
> pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
> + If your life is a hard drive, | 13 Roberts Road
> + Christ can be your backup. | Newtown Square, Pennsylvania 19073
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Martin Pitt 2005-12-22 18:24:07 Small bug fix in readline promt handling
Previous Message Tom Lane 2005-12-22 17:07:08 Re: [BUGS] My investigations of the postmaster Bus error