[Featureserver] permission denied to postGIS
Brent Pedersen
bpederse at gmail.com
Wed Aug 15 17:58:13 EDT 2007
On 8/15/07, Ed Fialkowski <edfialk at gmail.com> wrote:
> Well, I don't know if you're gonna believe this, but:
>
> [root at niceguy cgi-bin]# python
> Python 2.3.4 (#1, Jan 9 2007, 16:40:09)
> [GCC 3.4.6 20060404 (Red Hat 3.4.6-3)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import psycopg2
> >>> db = psycopg2.connect("dbname=test user=postgres")
> >>> print db.status
> 1
>
> Bam, connected as root. So, I go into PostGIS.py, and edit the connect line
> to:
>
> def begin (self):
> self.db = psycopg2.connect("dbname=test user=postgres")
>
this shouldnt work. and doesnt if you have this (default):
local all postgres ident sameuser
in your pg_hba.conf
>
> and....I still get permission denied
> I checked my pg_hba.conf:
> # TYPE DATABASE USER CIDR-ADDRESS METHOD
> # "local" is for Unix domain socket connections only
> local all all trust
> # IPv4 local connections:
> host all all 127.0.0.1/32 trust
> # IPv6 local connections:
> host all all ::1/128 trust
>
> local was set to all/all/trust. I created a user, granted permissions, and
> then specified user=ed in the dsn. I'm not sure if this is much different
> than user=postgres, but they both still gave me permission denied.
>
> So, I guess I'll start looking into reinstalling postgres with hopefully
> some looser permissioning.
>
> Thanks again.
> -Ed
>
so what happens if you do this:
db = psycopg2.connect("dbname=test user=ed") ?
you may also need to do something like:
GRANT SELECT, UPDATE, INSERT, DELETE ON geometry_columns TO ed;
GRANT SELECT, UPDATE, INSERT, DELETE ON spatial_ref_sys TO ed;
GRANT SELECT, UPDATE, INSERT, DELETE ON other_table TO ed;
i've noticed that sometimes
GRAN ALL on DATABASE dbname TO username;
doesnt work as advertised.
if that doesnt work, you may try starting with a new database and
create with you as the owner
$ createdb -O ed newdb
i've been messing with the postgresql admin stuff the past couple
weeks and have found this to be a concise reference:
http://code.djangoproject.com/wiki/GeoDjango#PostGIS
-brent
More information about the Featureserver
mailing list