Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fOBj2-0000dW-IZ for pgsql-general@arkaria.postgresql.org; Thu, 31 May 2018 00:45:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fOBiv-00022N-Sl for pgsql-general@arkaria.postgresql.org; Thu, 31 May 2018 00:45:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fOBiv-00022D-L7 for pgsql-general@lists.postgresql.org; Thu, 31 May 2018 00:45:49 +0000 Received: from [195.159.176.226] (helo=blaine.gmane.org) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fOBin-0005tI-MV for pgsql-general@postgresql.org; Thu, 31 May 2018 00:45:49 +0000 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fOBgc-0005z1-Q1 for pgsql-general@postgresql.org; Thu, 31 May 2018 02:43:26 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-general@postgresql.org From: George Neuner Subject: Re: Pgagent is not reading pgpass file either in Windows or Linux. Date: Wed, 30 May 2018 20:45:27 -0400 Lines: 48 Message-ID: References: <5595335e-32e8-80da-9c65-8d79fce554a7@aklaver.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@blaine.gmane.org User-Agent: ForteAgent/8.00.32.1272 X-Antivirus: Avast (VPS 180530-4, 05/30/2018), Outbound message X-Antivirus-Status: Clean X-Host-Lookup-Failed: Reverse DNS lookup failed for 195.159.176.226 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, 29 May 2018 13:32:46 -0700, Adrian Klaver wrote: >On 05/29/2018 12:14 PM, nageswara Bandla wrote: > >> As per the link- >> (https://www.postgresql.org/docs/9.6/static/libpq-pgpass.html) I set >> PGPASSFILE environment variable to point to pgpass.conf location. Even >> then, it’s throwing same above error message. I have found out that >> pgagent is not reading pgpass.conf file when configured under >> LocalSystem account. >> >> When I change the properties of the pgagent service to run under my >> login user account. Then, it’s reading pgpass.conf file under >> %APPDATA%/postgresql/pgpass.conf. >> >> I am clueless, why pgagent is not honoring PGPASSFILE env variable. > >My guess because the LocalSystem user does not have permissions on your: > >%APPDATA%/postgresql/pgpass.conf > >file. This seems to be confirmed by it working when you run pgagent as >the login user. LocalSystem has administrator permissions to virtually everything. https://msdn.microsoft.com/en-us/library/windows/desktop/ms684190(v=vs.85).aspx It should be able to read files belonging to any user. But the LocalSystem account can see only *global* environment variables ... it can't see any user specific ones. I would check if the PGPASSFILE variable is set globally or only in the user account. I don't know anything specifically about running pgagent on Windows, so I can't say why it is giving an error if the docs say it should not. George >passfile > > Specifies the name of the file used to store passwords (see Section >33.15). Defaults to ~/.pgpass, or %APPDATA%\postgresql\pgpass.conf on >Microsoft Windows. (No error is reported if this file does not exist.) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^