3

When creating a PostGIS store in GeoServer, the guidelines I saw ask us to fill in database connection parameters including:

host, port, database, schema, username, and password.

This is a bit problematic for my system because the PostgreSQL database is set up in a passwordless manner. Users can only connect to localhost using their user names without passwords. No password is needed or will be created for security purposes.

When I tried to Add Store without giving the password (which does not exist), I got the following error.

enter image description here

In my case, the webservers, GeoServer and PostgreSQL/PostGIS are on the same machine . The psql client can connect to the server on localhost passwordlessly without a issue.

Is it possible to set up PostgreSQL and GeoServer in such a way that the GeoServer to PostgreSQL connection does not require passwords?

3
  • You can use a JNDI connection
    – Ian Turton
    Commented May 1, 2016 at 18:39
  • I'm not sure if pgpass work with GeoServer, but it does for many other programs like psql, pgAdmin, ogr and others.
    – Mike T
    Commented May 1, 2016 at 21:03
  • update: to answer my own suggestion, no jdbc does not use pgpass
    – Mike T
    Commented May 1, 2016 at 22:43

1 Answer 1

1

If you are on linux you can probably use unix socket. Then you need to have specified thu user name in the pg_hba file for local, with trust or pair as authentication.

Then when you connect you shall not give a host name at all. At least in other softwares that gives you a local connection over unix socket.

3
  • Thanks for the pointer. I just tried this, but got an error: Field host is required on the New Vector Data Source page for adding store. This is with GeoServer 2.8 under linux
    – tinlyx
    Commented May 1, 2016 at 17:55
  • Yes I guess you are right. I guess GeoServer is using jdbc which, according to this answer seems to not support local connection via unix socket: stackoverflow.com/questions/4562471/… Commented May 1, 2016 at 21:10
  • Host set to localhost and user set to the system username, leaving empty the password works here.
    – pLumo
    Commented Aug 18, 2017 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.