Skip site navigation (1) Skip section navigation (2)

RE: Setting Permissions for web viewing

From: Chris <csmith(at)squiz(dot)net>
To: <pgsql-novice(at)hub(dot)org>
Subject: RE: Setting Permissions for web viewing
Date: 2000-10-19 22:45:49
Message-ID: 4.2.0.58.20001020084058.00a41da0@203.25.173.1 (view raw or flat)
Thread:
Lists: pgsql-novice
I wrote a very basic tutorial (which also has this part in it).
http://designmagick.50megs.com/postgresql-tutorial/

It's not very comprehensive, but it has a couple of things there.

>The pg_connect command worked as localhost, but then the pg_exec failed with
>permission errors?
>
>If you started from scratch, I think you would need to do the following
>things:
>
>1) determine who the "user" is that the webserver is running as (Suggestions
>on how to do this?)

for linux, not sure if bsd is different..

# ps aux | grep http

gives a list of all the http processes running... check the first column 
for the name of the process owner.

>2) set up that user in postgres with createuser (but I'm unsure how to best
>deal with the password, should it be NULL and then restrict the access or
>should it have a value that you pass as a parameter down the road?  This
>ties into point 4)

I've just never set a password.

>3) give that user permissions to access the database tables in the psql
>interface with the "GRANT" command
>
>4) figure out the best way of having the webserver (as "user") connect to
>the database, e.g. the options suggested below (although I assume the first
>option implies that the user is set up with a NULL password?  How would this
>work exactly?)

Since the user connecting to the database has access (as done with the 
grant command).... all I do is
pg_connect("","","","","dbname");
although there might be other / better ways :)

Chris.

In response to

pgsql-novice by date

Next:From: Mike WhiteDate: 2000-10-20 00:35:11
Subject: database design
Previous:From: kDate: 2000-10-19 20:04:28
Subject: RE: Setting Permissions for web viewing

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group