Thread: postgres user can connect but no one else

postgres user can connect but no one else

From
"A B"
Date:
I can do

# su - postgres
$ psql

and run sql commands, but  running
 psql
as the user I just created with the command

createuser -s -d -E -P -e myself

fails with
psql: could not connect to server: Permission denied
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"

I run psql as the "myself" user. and even psql -U myself template1
fails.  (template1 was the database that always is there, right?)

pg_hba.conf says

local   all         all                              trust
host    all         all         127.0.0.1/32          password
host    all         all         ::1/128               password

I'm not sure why I cant connect.

Re: postgres user can connect but no one else

From
"Obe, Regina"
Date:
This is a common problem.

You should add a line at the end something like (you make want to limit
the ip range)

host    all         all         0.0.0.0/0               md5


You should also make sure your postgresql.conf file listen setting is
set to

listen_addresses = '*'        # what IP address(es) to listen on;

and not
#listen_addresses = 'localhost'        # what IP address(es) to listen
on;

Hope this helps,
Regina

-----Original Message-----
From: pgsql-novice-owner@postgresql.org
[mailto:pgsql-novice-owner@postgresql.org] On Behalf Of A B
Sent: Monday, November 03, 2008 5:05 AM
To: pgsql-novice@postgresql.org
Subject: [NOVICE] postgres user can connect but no one else

I can do

# su - postgres
$ psql

and run sql commands, but  running
 psql
as the user I just created with the command

createuser -s -d -E -P -e myself

fails with
psql: could not connect to server: Permission denied
        Is the server running locally and accepting
        connections on Unix domain socket
"/var/run/postgresql/.s.PGSQL.5432"

I run psql as the "myself" user. and even psql -U myself template1
fails.  (template1 was the database that always is there, right?)

pg_hba.conf says

local   all         all                              trust
host    all         all         127.0.0.1/32          password
host    all         all         ::1/128               password

I'm not sure why I cant connect.

--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice
-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.

Re: postgres user can connect but no one else

From
Tom Lane
Date:
"A B" <gentosaker@gmail.com> writes:
> psql: could not connect to server: Permission denied
>         Is the server running locally and accepting
>         connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"

Did you actually put the socket file there?  If so, the problem is
probably lack of world read permission for /var/run/postgresql/.

            regards, tom lane