Re: Setting postgres user's password when running initdb

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Setting postgres user's password when running initdb
Дата
Msg-id 10933.1376503609@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Setting postgres user's password when running initdb  (Edd Grant <edd@eddgrant.com>)
Ответы Re: Setting postgres user's password when running initdb  (Edd Grant <edd@eddgrant.com>)
Список pgsql-novice
Edd Grant <edd@eddgrant.com> writes:
> My first time using postgres and I'm struggling setting the postgres user's
> password. Am using 9.2 btw,

> When prompted I type the password contained in
> /etc/pgsql/9.2/postgres.password but I get the following error:
> psql: FATAL:  Peer authentication failed for user "postgres"

This indicates that the database is not using password authentication;
it's using peer authentication, which basically checks that your actual
OS user name matches the database user name you want to log in as.

You could edit pg_hba.conf to fix this, or if you want to start over
there's a --auth switch for initdb.  Either way you want to select
the "md5" auth method not the "peer" method.

Another thing that would be worth checking is whether "service postgresql
initdb" is passing through any of those arguments at all.  I'm not real
sure that "service" makes that possible, nor that everyone's versions
of the init script do it even if it's possible.

The most robust way of dealing with this sort of thing is to not force the
issue, but just use peer auth initially --- that is, su to the postgres
account and then psql should let you in.  After that you can create more
users, set database passwords, and adjust the auth method to your taste.

It's worth reading most of this chapter:
http://www.postgresql.org/docs/9.2/static/client-authentication.html
Password auth is not the be-all and end-all; frequently, people end up
preferring peer auth anyway for local connections, so the default you're
getting here is not insane.

            regards, tom lane


В списке pgsql-novice по дате отправления:

Предыдущее
От: Edd Grant
Дата:
Сообщение: Setting postgres user's password when running initdb
Следующее
От: Edd Grant
Дата:
Сообщение: Re: Setting postgres user's password when running initdb