Re: Pgagent is not reading pgpass file either in Windows or Linux. - Mailing list pgsql-general

From George Neuner
Subject Re: Pgagent is not reading pgpass file either in Windows or Linux.
Date
Msg-id ppfugdp0kau1a9178injuk52b0eqg29i3o@4ax.com
Whole thread Raw
In response to Pgagent is not reading pgpass file either in Windows or Linux.  (nageswara Bandla <nag.bandla@gmail.com>)
Responses Re: Pgagent is not reading pgpass file either in Windows or Linux.  (nageswara Bandla <nag.bandla@gmail.com>)
List pgsql-general
On Tue, 29 May 2018 13:32:46 -0700, Adrian Klaver
<adrian.klaver@aklaver.com> 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.)
>                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^



pgsql-general by date:

Previous
From: Tim Cross
Date:
Subject: Re: LDAP authentication slow
Next
From: tango ward
Date:
Subject: Insert UUID GEN 4 Value