Changing the password for the postgres user (pgsql in FreeBSD)
differs depending on the version of PostgreSQL installed. To check the version,
type under root:
# psql --version
PostgreSQL 7.4.7 is used in the latest versions of H-Sphere for both
the H-Sphere system database and
user databases. However, earlier versions of H-Sphere use even Postgres 7.1.
For security reasons we recommend upgrading your PostgreSQL servers to:
- as postgres in RedHat:
# su - postgres
- as pgsql in FreeBSD:
# su - pgsql
$ pg_passwd data/passwd
Then, enter username (postgres or pgsql) and a new password when prompted.
Usernames and passwords are stored in the data/passwd file of the
postgres / pgsql user's home directory.
PostgreSQL 7.3 and up
The postgres/pgsql password is changed in the PostgreSQL service database.
This is a more secure way than having the passwords stored in a file. Run under root:
psql -d template1 -U postgres (enter the template1 service database)
alter user postgres with password 'postgres_password';
(run query to change the password)
psql -d template1 -U pgsql
alter user pgsql with password 'pgsql_password';
Restart Postgres to apply changes.