Re: grant connect to all databases - Mailing list pgsql-general

From Tom Lane
Subject Re: grant connect to all databases
Date
Msg-id 1062814.1728154679@sss.pgh.pa.us
Whole thread Raw
In response to Re: grant connect to all databases  (Matt Zagrabelny <mzagrabe@d.umn.edu>)
List pgsql-general
Matt Zagrabelny <mzagrabe@d.umn.edu> writes:
>  ...but I still cannot connect:

> $ psql -d test -U alice
> psql: error: connection to server on socket
> "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL:  permission denied for
> database "test"
> DETAIL:  User does not have CONNECT privilege.

This shouldn't be happening, since as mentioned upthread our default
for newly-created databases is that they have CONNECT granted to
PUBLIC.  It works fine for me, even for a user with no special
permissions:

postgres=# create user alice;
CREATE ROLE
postgres=# create database test;
CREATE DATABASE
postgres=# \c test alice
You are now connected to database "test" as user "alice".

If I explicitly revoke the privilege, I can duplicate your
results:

test=> \c postgres postgres
You are now connected to database "postgres" as user "postgres".
postgres=# revoke connect on database test from public;
REVOKE
postgres=# \c test alice
connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL:  permission denied for database "test"
DETAIL:  User does not have CONNECT privilege.

I wonder if your puppet recipe is revoking that behind your
back, or if you are using some modified version of Postgres
with different ideas about default privileges.  Looking at
psql \l output for the test DB might be informative.

            regards, tom lane



pgsql-general by date:

Previous
From: Matt Zagrabelny
Date:
Subject: Re: grant connect to all databases
Next
From: Tom Lane
Date:
Subject: Re: Repeatable Read Isolation Level "transaction start time"