Re: [GENERAL] pg_hba.conf and crypt - Mailing list pgsql-general

From Kevin Lo
Subject Re: [GENERAL] pg_hba.conf and crypt
Date
Msg-id 3731D17B.B0F577FF@ms11.hinet.net
Whole thread Raw
In response to Re: [GENERAL] pg_hba.conf and crypt  ("Oliver Elphick" <olly@lfix.co.uk>)
Responses Re: [GENERAL] pg_hba.conf and crypt  ("Oliver Elphick" <olly@lfix.co.uk>)
List pgsql-general
Oliver Elphick wrote:

> This is a document I wrote some time ago on this subject.  If any parts of
> it are no longer accurate, please let me know.
>
> ====================================
> How to use clear or encrypted passwords for PostgreSQL access:
> =============================================================
>
> Use lines such as
>
>   local         all                             password
>   host          192.137.23      255.255.255.0   crypt
>
> in /etc/postgresql/pg_hba.conf; then you can use
>
>    CREATE USER user WITH PASSWORD password...
>
> to create a new user with the specified password, or
>
>    ALTER USER user WITH PASSWORD password...
>
> to change the password of an existing user.  ANY USER with create-user
> privilege can ALTER a password for any user, *INCLUDING* the postgres
> super-user.
>
> If connecting with psql, use the -u option; the user is prompted for username
> and password.  If you don't use -u, the connection fails.

Hi, Oliver,

I follow your instructions to do on my local machine, edit the file
pg_hba.conf:

local        all                                         password
host         all   127.0.0.1     255.255.255.255         crypt

then I connect with psql, use the -u option, I got the following errors:

% psql -u
Username: postgres
Password:

User authentication failed
Connection to database 'postgres' failed.
User authentication failed

If I don't edit the file pg_hba.conf, I can connect template1
with no problem. I have run createuser and have created the user 'postgres'.
Would you like to tell me how to solve this problem, thanks.

-Kevin.



pgsql-general by date:

Previous
From: Louis Zirkel III
Date:
Subject: Re: [GENERAL] pg_hba.conf and crypt
Next
From: "Oliver Elphick"
Date:
Subject: Re: [GENERAL] pg_hba.conf and crypt