From: | Edd Grant <edd(at)eddgrant(dot)com> |
---|---|
To: | |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Setting postgres user's password when running initdb |
Date: | 2013-08-14 19:16:50 |
Message-ID: | CAO5arLN27g63wQ9td2kK34duiLHP9KCrfxXUXeC9VrR9_=OfQA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Edd Grant <edd(at)eddgrant(dot)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(at)eddgrant(dot)com
Mobile: +44 (0) 7861 394 543
From | Date | Subject | |
---|---|---|---|
Next Message | Birchall, Austen | 2013-08-15 09:51:58 | sudo/access to the postres OS user |
Previous Message | Tom Lane | 2013-08-14 18:06:49 | Re: Setting postgres user's password when running initdb |