Thread: can't get user authentication to work - HELP!

can't get user authentication to work - HELP!

From
"Floyd Shackelford"
Date:
I just can't seem to figure out how to get the userid/password thing to
work.

i created a database called a_database.

i created a user using createuser named "user1" with password "password1"

my pg_hba.conf file has the following entry:

host all  192.168.1.0   255.255.255.0  password pg_passwd

i try the following:

psql -h 192.168.1.200 -d a_database -U user1 -W

and i enter "password1" (sans quotes) at the password prompt and get:

psql: FATAL 1:  SetUserId: user 'user1' is not in 'pg_shadow'

How do I get this to work? How do i get an entry into pg_shadow?

I even tried it with the postgres super user:

psql -h 192.168.1.200 -d a_database -U postgres -W

and I get:

psql: Password authentication failed for user 'postgres'

What do I do to get user authentication to work?

Regards,
Floyd Shackelford
4 Peaks Technology Group, Inc., http://www.4peakstech.com/
dba Corona Professional Services, http://www.coronaps.com/
P. O. Box 27740, Las Vegas, Nevada  89126
office: +1.888.398.4405  fax: +1.916.404.7125
net2phone nickname: fwshack  PGPfone: enabled

"[A]ll men are ... endowed by their Creator with certain unalienable Rights
... whenever ... Government becomes destructive of these Ends, it is the
Right of the People ... it is their Duty, to throw off such
Government...." --Declaration of Independence


Re: can't get user authentication to work - HELP!

From
Peter Eisentraut
Date:
Floyd Shackelford writes:

> i created a user using createuser named "user1" with password "password1"
> my pg_hba.conf file has the following entry:
> host all  192.168.1.0   255.255.255.0  password pg_passwd

> i try the following:
> psql -h 192.168.1.200 -d a_database -U user1 -W
> and i enter "password1" (sans quotes) at the password prompt and get:
> psql: FATAL 1:  SetUserId: user 'user1' is not in 'pg_shadow'
>
> How do I get this to work? How do i get an entry into pg_shadow?

Normally you get one with createuser.  Perhaps you have two different
postmasters running and the createuser command picked the wrong one?

> psql -h 192.168.1.200 -d a_database -U postgres -W
> and I get:
> psql: Password authentication failed for user 'postgres'

By default the postgres user doesn't have a password.  You need to give it
one first. (See ALTER USER.)

--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/


Re: can't get user authentication to work - HELP!

From
Tom Lane
Date:
"Floyd Shackelford" <floyds@4peakstech.com> writes:
> my pg_hba.conf file has the following entry:
> host all  192.168.1.0   255.255.255.0  password pg_passwd

You probably just want

host all  192.168.1.0   255.255.255.0  password

What you have specifies an "alternate password file" named pg_passwd.
It's unlikely you need an alternate file.

The above might account for the failure to connect as superuser;
most likely the pg_passwd file hasn't got an entry for the superuser
(if the file even exists at all).  Another possibility is that you
didn't set a password for the superuser.

Not sure why you're getting the other message
> psql: FATAL 1:  SetUserId: user 'user1' is not in 'pg_shadow'
createuser should've handled that for you.  What is in pg_shadow
anyway?  (do a "select * from pg_shadow" as superuser to find out)

            regards, tom lane