Re: How to know the password for the user 'postgres'

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Shashank Sahni" <shredder12(at)gmail(dot)com>
Cc: "Tony Caduto" <tony_caduto(at)amsoftwaredesign(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to know the password for the user 'postgres'
Date: 2008-10-28 06:03:05
Message-ID: dcc563d10810272303l3e677ec7vefd0cf2859301ed6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Oct 27, 2008 at 11:34 PM, Shashank Sahni <shredder12(at)gmail(dot)com> wrote:
>
> On Tue, Oct 28, 2008 at 10:52 AM, Tony Caduto
> <tony_caduto(at)amsoftwaredesign(dot)com> wrote:
>>
>> Edit the pg_hba.conf file and add a entry for the PC you are doing your
>> admin from and set it to Trust.
>> When set to trust you won't need a password, then use the admin tool of
>> your choice to change the postgres password to whatever
>> you want. Afterwards remember to set it back to MD5 or whatever it was
>> prior to you making the change.
>>
>> Later,
>>
>> Tony Caduto
>> AM Software Design
>> http://www.amsoftwaredesign.com
>
> My pg_hba.conf file looks like this..
> -----------------------------------------------------------------------------------------------
> # Database administrative login by UNIX sockets
> local all postgres ident sameuser
>
> # TYPE DATABASE USER CIDR-ADDRESS METHOD
>
> # "local" is for Unix domain socket connections only
> local all all ident sameuser
> # IPv4 local connections:
> host all all 127.0.0.1/32 md5
> # IPv6 local connections:
> host all all ::1/128 md5
> host dspace dspace 127.0.0.1 255.255.255.255 md5
> ------------------------------------------------------------------------------------------
> Can you tell me which entry should i modify or what entry should i exactly
> add ( as you have already mentioned)..
> Please don't mind my stupid questions..I am a newbie so I don't have much
> idea about it..
> I would greatly appreciate your help...

No need for apologies, we all learn by doing. The pg_hba.conf file is
a simple first match filter. PostgreSQL takes the attempted incoming
connection and looks for the first line that matches and processes the
login accordingly. Have you read the fine documentation IN the
pg_hba.conf file itself?

the important bit is that you have local and host type connections to
worry about, and local means unix local sockets (i.e. psql without a
-h or createdb without a -h) and host means that it's using tcp/ip to
connect.

It's quite often simple enough to set a local for the postgres user of
ident so local maintenance tasks can run under the postgres account,
then use -h hostname or -h ip to connect to the server with passwords.

So, leave it for now, sudo su - postgres, create your user, set a
password (see alter user within psql (i.e. from psql type \h alter
user) or the createuser command line command (i.e. createuser -h) for
more info on how to set the password.) I think

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ivano Luberti 2008-10-28 07:52:51 Re: Replication with slony-I
Previous Message Shashank Sahni 2008-10-28 05:34:42 Re: How to know the password for the user 'postgres'