PAM authentication + pgAdmin fails remotely, but locally works
<p>I've been trying to configure postgresql with PAM on a Red hat server so that I can get remote access to the server via pgAdmin and use local (server) authentication with PAM.</p>

<p>I have edited the pg_hba.conf file and changed the appropriate line:</p>

<pre><code>host postgres all 0.0.0.0/0 md5
</code></pre>

<p>and added this one:</p>

<pre><code>host    pam_testing       all  0.0.0.0/0   pam    pamservice=postgresql95
</code></pre>

<p>Moreover I created database user with the same username as I use to log in with putty (no password, simply create user xxx)</p>

<p>When I try to log in remotely with pgAdmin to postgres database (using md5) with my database user everything works smoothly.</p>

<p>But When I try to connect (also remotely, with pgAdmin) to pam_testing database with my server username (to which I log in via ssh using putty) and give the password I get the following error:</p>

<blockquote>
  <p>Error connecting to the server: FATAL: PAM authentication failed for
  user XXX</p>
</blockquote>

<p>BUT! When I log in locally to pam_testing while connected via putty it works! My system user gets logged in and authenticated without any problems. And it only happens for users, which I added to the database using create user.</p>

<p>I'm guessing it must be some kind of authentication issue (with the server maybe? It belongs to company and I don't know what other authentication methods it uses) but I'm not sure. Any ideas?</p>

<p>System: Red hat 6.8,
Postgresql: 9.5</p>

<p>Thanks in advance!</p>