Re: Setting postgres user's password when running initdb

Поиск
Список
Период
Сортировка
От Edd Grant
Тема Re: Setting postgres user's password when running initdb
Дата
Msg-id CAO5arLN27g63wQ9td2kK34duiLHP9KCrfxXUXeC9VrR9_=OfQA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Setting postgres user's password when running initdb  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice
Hi Tom,

Thanks for your response, I'd not noticed the 'Peer' in the message - stupid to have missed it.

Have skimmed the chapter you refer to but will go back and have a proper look at it so I can best decide what will work for us.

Thanks again,

Edd




On 14 August 2013 19:06, Tom Lane <tgl@sss.pgh.pa.us> wrote:
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



--
Web: http://www.eddgrant.com
Email: edd@eddgrant.com
Mobile: +44 (0) 7861 394 543

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Setting postgres user's password when running initdb
Следующее
От: "Birchall, Austen"
Дата:
Сообщение: sudo/access to the postres OS user