Re: Re: Postgres access using PHP - Mailing list pgsql-novice

From Anthony E . Greene
Subject Re: Re: Postgres access using PHP
Date
Msg-id 20010115161322.M645@cp5340
Whole thread Raw
In response to Re: Postgres access using PHP  (John Poltorak <jp@eyup.org>)
List pgsql-novice
On Sun, 14 Jan 2001 18:29:21 John Poltorak wrote:
>Many thanks to everyone who suggested my Web server was running as 'root'
>and this was the cause of the problem.
>
>I'd just like to point out that I'm running Postgres, PHP4, and Xitami
>all under OS/2, which is a single-user OS, and the USER variable does
>not get set automatically.
>
>I have set the this variable to POSTGRES before starting Xitami,
>just to make sure I can get everything going and it works fine now,

The way I do it is create a PostgreSQL user named "nobody" which functions
as the default account for web access. I also have other accounts for
privileged access. When I connect using a CGI script, the script checks to
see if the remote_user() is listed in pg_user table. If so, it access the
database using the associated permissions. If not, then it accesses the
database using the permissions assigned to the user "nobody", which may mean
no permissions.

You don't have to use CGI for this to work. You just need a way for the
script to authenticate users and use the resulting username when connecting
to the database.

Tony
--
Anthony E. Greene <agreene@pobox.com> <http://www.pobox.com/~agreene/>
PGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44 BA26  C484 A42A 60DD 6C94 239D
Chat:  AOL/Yahoo: TonyG05    ICQ: 91183266
Linux. The choice of a GNU Generation. <http://www.linux.org/>

pgsql-novice by date:

Previous
From: "Anthony E . Greene"
Date:
Subject: Re: Two novice questions
Next
From: Ken Corey
Date:
Subject: Yikes! Bitten by line length?