Re: I need to know password for postgres

Lists: pgsql-novice
From: David Robertson <david(at)robertsonphoto(dot)fsnet(dot)co(dot)uk>
To: pgsql-novice(at)postgresql(dot)org
Subject: I need to know password for postgres
Date: 2002-08-13 20:27:31
Message-ID: 3D596BB3.9070209@robertsonphoto.fsnet.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

I need to know the password for User postgres. I am trying to set up
gphotocoll which uses pgsql.

The setup insructions are

1. login as postgres - which I can only do by su and then su postgres.
2. createdb - no problem
3. launch gphotocoll as postgres. I have to supply the password for
postgres and I don't know it.

I'm running pgsql 7.2.1 RPMs on Redhat 7.3. Postmaster is running.

If you can help, please don't assume too much knowledge on my part of
Linux! I've still much to learn.

Thanks

Dave


From: "Chad Thompson" <chad(at)weblinkservices(dot)com>
To: "David Robertson" <david(at)robertsonphoto(dot)fsnet(dot)co(dot)uk>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: I need to know password for postgres
Date: 2002-08-13 20:31:23
Message-ID: 030301c24308$64ab4320$32021aac@chad
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

from a prompt type
"passwd postgres" (no quotes)

this will prompt you to change the password for postgres

Thanks
Chad

----- Original Message -----
From: "David Robertson" <david(at)robertsonphoto(dot)fsnet(dot)co(dot)uk>
To: <pgsql-novice(at)postgresql(dot)org>
Sent: Tuesday, August 13, 2002 2:27 PM
Subject: [NOVICE] I need to know password for postgres

> I need to know the password for User postgres. I am trying to set up
> gphotocoll which uses pgsql.
>
> The setup insructions are
>
> 1. login as postgres - which I can only do by su and then su postgres.
> 2. createdb - no problem
> 3. launch gphotocoll as postgres. I have to supply the password for
> postgres and I don't know it.
>
> I'm running pgsql 7.2.1 RPMs on Redhat 7.3. Postmaster is running.
>
> If you can help, please don't assume too much knowledge on my part of
> Linux! I've still much to learn.
>
> Thanks
>
> Dave
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Robertson <david(at)robertsonphoto(dot)fsnet(dot)co(dot)uk>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: I need to know password for postgres
Date: 2002-08-13 21:35:03
Message-ID: 1446.1029274503@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

David Robertson <david(at)robertsonphoto(dot)fsnet(dot)co(dot)uk> writes:
> 1. login as postgres - which I can only do by su and then su postgres.
> 2. createdb - no problem
> 3. launch gphotocoll as postgres. I have to supply the password for
> postgres and I don't know it.

If you are the postgres OS user then you can force your way in anyway.
Temporarily change $PGDATA/pg_hba.conf to allow "trust" login, then
connect to the database with psql, then use ALTER USER command to
set the database password for postgres to whatever you want. Then
you can revert pg_hba.conf to a less insecure setting. (Or read the
admin guide and work out what connection security policy suits your
needs. On a single-user box, "trust" might be perfectly okay.)

BTW, I'd suggest creating an unprivileged database user for gphotocoll
to run as. If you don't run gphotocoll as Linux root, you probably
shouldn't run it as a database superuser either.

regards, tom lane


From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Chad Thompson <chad(at)weblinkservices(dot)com>
Cc: David Robertson <david(at)robertsonphoto(dot)fsnet(dot)co(dot)uk>, pgsql-novice(at)postgresql(dot)org
Subject: Re: I need to know password for postgres
Date: 2002-08-13 21:40:11
Message-ID: 1029274812.1353.648.camel@linda
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

On Tue, 2002-08-13 at 21:31, Chad Thompson wrote:
> from a prompt type
> "passwd postgres" (no quotes)
>
> this will prompt you to change the password for postgres
...
> > The setup insructions are
> >
> > 1. login as postgres - which I can only do by su and then su postgres.
> > 2. createdb - no problem
> > 3. launch gphotocoll as postgres. I have to supply the password for
> > postgres and I don't know it.

No he doesn't need to change the Unix password for postgres; he had
already got access to that by using su.

If you really need a database password, do this:

To get access to the database, edit pg_hba.conf, which is stored in
the top-level data directory. I don't know where its default
location is on Red Hat.

There should be a lot of explanatory comment in that file. That
should help you understand what it does. Presumably the first line
that matches the way gphotocoll is trying to access it is a line
that specifies password or crypt.

To set the database password for postgres, add this line at the top
of pg_hba.conf:

local all trust

Connect to PostgreSQL with psql from the postgres Unix account:

psql -d template1

Change the postgres password:

ALTER USER postgres WITH PASSWORD 'this_is_my_password';

Type Ctrl-D or \q to come out of psql

Edit pg_hba.conf again and remove the trust line.

But I'm not sure you do need a password with the set up you described;
you said that createdb worked and you did not have to supply a password.
If you had universal password access control, createdb would have asked
you for a password.

Perhaps you should post the contents of your pg_hba.conf (without the
comments!). It may be that you need to do something to allow a Unix
user who is not "postgres" to access the database as "postgres". I
would also want to know why gphotocoll has to be user "postgres", since
this gives it administration rights over the whole database
installation.

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight, UK
http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"Watch ye therefore, and pray always, that ye may be
accounted worthy to escape all these things that shall
come to pass, and to stand before the Son of man."
Luke 21:36


From: David Robertson <david(at)robertsonphoto(dot)fsnet(dot)co(dot)uk>
To: pgsql-novice(at)postgresql(dot)org
Cc: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
Subject: Re: I need to know password for postgres
Date: 2002-08-14 20:04:22
Message-ID: 3D5AB7C6.3050201@robertsonphoto.fsnet.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

Oliver,
There are no uncommented entries in pg_hba.conf. Surely
I need to uncomment some of these?

I have managed to give postgres a password but I can't access database.

To be honest I screwed up and have reinstalled my Redhat partition so
I'm back to square one ie. the postgresql and gphotocoll RPMs installed.

Thanks for taking the trouble.

Dave

Oliver Elphick wrote:

>On Tue, 2002-08-13 at 21:31, Chad Thompson wrote:
>
>>from a prompt type
>>"passwd postgres" (no quotes)
>>
>>this will prompt you to change the password for postgres
>>
>...
>
>>>The setup insructions are
>>>
>>>1. login as postgres - which I can only do by su and then su postgres.
>>>2. createdb - no problem
>>>3. launch gphotocoll as postgres. I have to supply the password for
>>>postgres and I don't know it.
>>>
>
>No he doesn't need to change the Unix password for postgres; he had
>already got access to that by using su.
>
>If you really need a database password, do this:
>
> To get access to the database, edit pg_hba.conf, which is stored in
> the top-level data directory. I don't know where its default
> location is on Red Hat.
>
> There should be a lot of explanatory comment in that file. That
> should help you understand what it does. Presumably the first line
> that matches the way gphotocoll is trying to access it is a line
> that specifies password or crypt.
>
> To set the database password for postgres, add this line at the top
> of pg_hba.conf:
>
> local all trust
>
> Connect to PostgreSQL with psql from the postgres Unix account:
>
> psql -d template1
>
> Change the postgres password:
>
> ALTER USER postgres WITH PASSWORD 'this_is_my_password';
>
> Type Ctrl-D or \q to come out of psql
>
> Edit pg_hba.conf again and remove the trust line.
>
>But I'm not sure you do need a password with the set up you described;
>you said that createdb worked and you did not have to supply a password.
>If you had universal password access control, createdb would have asked
>you for a password.
>
>Perhaps you should post the contents of your pg_hba.conf (without the
>comments!). It may be that you need to do something to allow a Unix
>user who is not "postgres" to access the database as "postgres". I
>would also want to know why gphotocoll has to be user "postgres", since
>this gives it administration rights over the whole database
>installation.
>


From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: David Robertson <david(at)robertsonphoto(dot)fsnet(dot)co(dot)uk>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: I need to know password for postgres
Date: 2002-08-14 20:14:54
Message-ID: 1029356094.28727.63.camel@linda
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

On Wed, 2002-08-14 at 21:04, David Robertson wrote:
> Oliver,
> There are no uncommented entries in pg_hba.conf. Surely
> I need to uncomment some of these?

I'm surprised. Is that how Red Hat distributes it?

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight, UK
http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"Let us therefore come boldly unto the throne of grace,
that we may obtain mercy, and find grace to help in
time of need." Hebrews 4:16