Re: Re: Postgres access using PHP

From: "Anthony E (dot) Greene" <agreene(at)pobox(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Re: Postgres access using PHP
Date: 2001-01-15 21:13:22
Message-ID: 20010115161322.M645@cp5340
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)pobox(dot)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/>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Ken Corey 2001-01-16 00:05:37 Yikes! Bitten by line length?
Previous Message Anthony E . Greene 2001-01-15 21:03:38 Re: Two novice questions