In a fix: lost superuser

Started by Kenalmost 25 years ago4 messagesgeneral
Jump to latest
#1Ken
mailinglists@creason.com

Is there any way to reset the superuser password
if it has been lost? I thought it was set properly
but it is now among the ethers, and none of the other
accounts have superuser privileges. I've tried replacing
pg_shadow with another in hopes of resetting the darn
thing, but alas. Do I have to re-install postgres?
Is there any way for the root user to reset the password?

_Ken

#2Holger Klawitter
holger@klawitter.de
In reply to: Ken (#1)
Re: In a fix: lost superuser

Ken wrote:

Is there any way to reset the superuser password
if it has been lost? I thought it was set properly
but it is now among the ethers, and none of the other
accounts have superuser privileges. I've tried replacing
pg_shadow with another in hopes of resetting the darn
thing, but alas. Do I have to re-install postgres?
Is there any way for the root user to reset the password?

You can modify pg_hba.conf in order to "trust" the PG_USER
setting of the client. Then you can modify the internal system
tables in order to reset the password.

With kind regards / Mit freundlichem Gru�
Holger Klawitter
--
Holger Klawitter
holger@klawitter.de http://www.klawitter.de

#3(J.H.M. Dassen \(Ray\))
jdassen@cistron.nl
In reply to: Ken (#1)
Re: In a fix: lost superuser

Ken <mailinglists@creason.com> wrote:

Is there any way to reset the superuser password if it has been lost?

I haven't tried it, but I guess the following should work:
- As root, edit the pg_hba.conf to allow access without the postgres
superuser password
"host all 127.0.0.1 255.255.255.255 trust"
- connect to postgres
"psql -U postgres template1"
- put a new password on the postgres user
"alter user postgresql with password 'fubar'"
- restore the old pg_hba.conf

HTH,
Ray
--
NATUURLIJK krijg je er geen signaal doorheen - het is *dark* fibre.
jtv

#4Ken
mailinglists@creason.com
In reply to: (J.H.M. Dassen \(Ray\)) (#3)
Re: In a fix: lost superuser

Thanks for all the great responses :)
They worked as expected.
_Ken

At 07:39 AM 5/14/01 +0000, you wrote:

Show quoted text

Ken <mailinglists@creason.com> wrote:

Is there any way to reset the superuser password if it has been lost?

I haven't tried it, but I guess the following should work:
- As root, edit the pg_hba.conf to allow access without the postgres
superuser password
"host all 127.0.0.1 255.255.255.255 trust"
- connect to postgres
"psql -U postgres template1"
- put a new password on the postgres user
"alter user postgresql with password 'fubar'"
- restore the old pg_hba.conf

HTH,
Ray
--
NATUURLIJK krijg je er geen signaal doorheen - het is *dark* fibre.
jtv

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org