[GIS] set up a PostGIS store/connection in GeoServer without user password for database

geoserverpasswordpostgispostgresql

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?

Best Answer

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.