Thread: Can you help a newbie?
Hi All, I am new to pgsql, I have inherited a database with no documentation, i.e. nobody knows the passwords for any of the database accounts. Anybody have any ideas on how to change the passwords without first knowing the passwords? If this is a stupid question I apologize in advance. Thanks! Jamie Bumsted Systems Engineer Evertek, Inc.
Hmm... very suspicious... However, if you have root on that machine, try this: su - root su - postgres cd /var/lib/pgsql/data vi pg_hba.conf add: local databasename trust Restart postgres, Switch back to your user, then try: psql databasename postgres Bingo, you're in as the DB admin. GRANT <blah> from here on in. Regards, Phil +----------------------------------+ | Phil Mayers, Network Support | | Centre for Computing Services | | Imperial College | +----------------------------------+ -----Original Message----- From: Jamie Bumsted [mailto:jbumsted@evertek.net] Sent: 07 February 2001 12:53 To: pgsql-general@postgresql.org Subject: [GENERAL] Can you help a newbie? Hi All, I am new to pgsql, I have inherited a database with no documentation, i.e. nobody knows the passwords for any of the database accounts. Anybody have any ideas on how to change the passwords without first knowing the passwords? If this is a stupid question I apologize in advance. Thanks! Jamie Bumsted Systems Engineer Evertek, Inc.
On Wed, 7 Feb 2001, Jamie Bumsted wrote: > Hi All, > I am new to pgsql, I have inherited a database with no documentation, i.e. > nobody knows the passwords for any of the database accounts. Anybody have > any ideas on how to change the passwords without first knowing the > passwords? As system root user you can see pg_pwd file in postgres data dir (probably in /var/postgres or /var/lib/postgres ..etc.), password aren't encrypted. Karel
On Wed, Feb 07, 2001 at 06:53:13AM -0600, Jamie Bumsted wrote: > Hi All, > I am new to pgsql, I have inherited a database with no documentation, i.e. > nobody knows the passwords for any of the database accounts. Anybody have > any ideas on how to change the passwords without first knowing the > passwords? You can edit your pg_hba.conf to allow local access with no passwords (add a line like "local all trust" above other non-comment lines) and then connect to the database as the database superuser (usually "postgres") and use "alter user" to change the passwords to whatever you like. Don't forget to change pg_hba.conf back afterwards. Richard
Jamie Bumsted wrote: > > Hi All, > I am new to pgsql, I have inherited a database with no documentation, i.e. > nobody knows the passwords for any of the database accounts. Anybody have > any ideas on how to change the passwords without first knowing the > passwords? > If this is a stupid question I apologize in advance. There are different ways of password protecting a database. postgres may even rely on the host based user authentification. The internal passwords, however, are stored in $PGHOME/data/pg_pwd in plain text. I thinks it's obvious enough not to make secret out of it :-) With kind regards / Mit freundlichem Gruß Holger Klawitter -- Holger Klawitter holger@klawitter.de http://www.klawitter.de