pg_hba.conf on Linux

From: "Peter Ball" <peter(dot)ball(at)exasites(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: pg_hba.conf on Linux
Date: 2000-12-26 22:29:13
Message-ID: 001001c06f8b$46dd0100$0300a8c0@exasites.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hi, we want to create a simple db from the command line, We ARE able to see
the Cobalt Internal db's like sites, users etc. using psql, so PostgreSQL is
installed and running fine.

But we get the following error message (we get much the same error from
phpPGadmin) .

[root upload]# /usr/bin/createdb test
psql: No pg_hba.conf entry for host localhost, user root, database template1
createdb: database creation failed
[root upload]#

We then did ...
[root pgsql]# locate pg_hba.conf
/var/lib/pgsql/data/pg_hba.conf
/home/chiliasp/odbc/internaldb/data/pg_hba.conf
/home/chiliasp/odbc/internaldb/data/pg_hba.conf~
/home/sites/site15/web/upload/pg_hba.conf
/usr/lib/pgsql/pg_hba.conf.sample

We then created a text file with "local trust all" and copied it into
the following
/usr/lib/pgsql/data/
/usr/lib/pgsql/
/var/lib/pgsql/data/

We then get a new error (after the last copy above) - A step foreward though
I suspect ...

Warning: Unable to connect to PostgresSQL server: Missing or erroneous
pg_hba.conf file, see postmaster log for details in lib.inc.php on line 121
Error - /home/sites/site21/web/phpPgAdmin/index.php
PostgreSQL said: Unable to connect to server

BUT, for some reason the Cobalt did NOT like me changing it's pg_hba.conf
file (even though the original was just comment lines explaining how it
worked). The screen to create sites etc. and some other stuff died, but
fortunatly I had a backup which we restored and now it's ok. But I'm sort of
back to square 1 again.

I tried echo $PGDATA but it just goes back to the prompt again.

Someone told me that Cobalt puts a long password (randomly generated) onto
Postgres to lock it down. we know how to get it, does it need to be
specified here or somewhere?

Also we are using telnet from a remote location, do we have to specify our
IP or anything?

Where should this pg_hba.conf file live on a standard cobalt RaQ4 (Redhat)?

Is the syntax of our pg_hba.conf correct?

Any help given to us would be greatly appreciated, and if you ever come to
Australia, please stop in at my place for a few beers.

Peter

p.s. The Cobalt Knowledgebase has these instructions but say "These
instructions refer to the RaQ3 ONLY!" Does anyone know what should be
changed for the RAQ4?

QuestionNum: 823
Product: RaQ3
Category Software
Creation Date: Thu May 25 09:32:55 2000 PDT

Question
How can I accesss the Postgres database server on the RaQ3 to add databases,
create tables, and add users?

Response

The following process will give the postgres user called "admin" the
super-user privilage. Once this is done, a user can log into postgres using
the admin account and modify itself to allow creation of users and
databases.

1. telnet in as admin

2. use su - to switch to root

[admin(at)raq3 admin]$ su -
Password:

[root(at)raq3 /root]#

3. use an editor and open the file /home/pgsql/pg_hba.conf

[root(at)raq3 /root]# vi /home/pgsql/pg_hba.conf

4. Change local all crypt to local all trust

5. use su to switch to the user ID postgres

[root(at)raq3 /root]# su postgres
[postgres(at)raq3 /root]$

6. Now run the psql program to connect to the database server.

[postgres(at)raq3 /root]$ psql cobalt
Welcome to the POSTGRESQL interactive sql monitor:
Please read the file COPYRIGHT for copyright terms of POSTGRESQL
[PostgreSQL 6.5.2 on i686-pc-linux-gnu, compiled by gcc egcs-2.91.66]

type ? for help on slash commands
type q to quit
type g or terminate with semicolon to execute query
You are currently connected to the database: cobalt

cobalt=>

7. Enter the following commands to give super-user privilage to admin and
quit.

cobalt=> update pg_shadow set usesuper='t' where usename='admin';
UPDATE 1
cobalt=> q
[postgres(at)raq3 /root]$

8. Use the exit command to become "root" again.

9. Now open the /home/pgsql/pg_hba.conf file and change "local all trust"
back to "local all crypt".

It is now possible to access postgres using the postgres account "admin".
The password for this account is stored in the file /etc/cobalt/.meta.id and
should not be changed. If the password needs to be changed, it must be
changed in the pg_shadow table and the /etc/cobalt/.meta.id file. Be sure to
maintain file permissions on the file or system security could be
compromised.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Trond Eivind =?iso-8859-1?q?Glomsr=F8d?= 2000-12-26 22:58:34 Re: red hat/mysql fiasco
Previous Message eriko 2000-12-26 22:09:48 Tuning Database