LKBEN11151: Howto connect to postgres from the network


You want to connect to your postgresql server but you do not get access to the system although the server is listening on port 5432.




In the case your server is listening to the default port and you do not get access, you will have to make changes to your pg_hba.conf file.

On debain you can find this file in a postgres dependent path. e.g.


For information about how to make postgres listen on your network card, which is not the default, you can search in the knowledge base on "Howto make shure postgres will listen on the network".

In your pg_hba.conf file you will find the following:

# "local" is for Unix domain socket connections only
local   all         all                               ident sameuser
# IPv4 local connections:
host    all         all          md5
# IPv6 local connections:
host    all         all         ::1/128               md5

I you want to listen from a full class network with subnet mask you can add the following line:

host    all         all        trust

If you restart your postgres server, you will be able to connect from the network.

Restarting can be done with:

invoke-rc.d postgresql-8.3 restart


The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!

About the Author

Author: Wim Peeters - Keskon GmbH & Co. KG

Wim Peeters is electronics engineer with an additional master in IT and over 30 years of experience, including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform.