nss-pgsql

Of no real interest to any of you. I have had great difficulty in getting pam_pgsql/nss-pgsql to work properly. One of my problems involved bash hanging if you tried

$su dbtest

where dbtest is a user in the postgresql database.

The problem seems to be to do with pthread locking. libpq wants to access $HOME/.postgresql/ in order to initiate a database connection, but in order for libnss-pgsql to find out what $HOME is it needs to initiate a database connection (see the debian bug report)

My solution is to configure libnss to use unix sockets to connect to the database (this doesn’t require accessing $HOME/.postgresql/ because libpq only needs access to that folder if it is going to do ssl based connections). This can be done by setting

host = /var/run/postgresql

in /etc/nss-pgsql.conf (on debian at least).  Once I’ve completed my pam_pgsql/nss-pgsql setup I’ll write about it.

Leave a Reply