pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: nageswara Bandla <nag.bandla@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Pgagent is not reading pgpass file either in Windows or Linux.
Date: Wed, 30 May 2018 10:53:41 -0700
Message-ID: <98dc353c-8d69-49d6-5ee9-01f53344d284@aklaver.com> (raw)
In-Reply-To: <CADJadRBkfokPYGM=+ptGpK+VGF0ag3iOB=4zVDOR15Xmpz_fSg@mail.gmail.com>
References: <CADJadRDCoHALsJQv8ySQiO2QdgWnfqVL+iX-v72QxA6pFtgYtg@mail.gmail.com>
	<5595335e-32e8-80da-9c65-8d79fce554a7@aklaver.com>
	<CADJadRDZLZyRuD20dDy-LkV9hrZhKkzObQYHHWDTKt1iZEDtHQ@mail.gmail.com>
	<12119160-c746-926a-110a-f82a0e769728@aklaver.com>
	<CADJadRBkfokPYGM=+ptGpK+VGF0ag3iOB=4zVDOR15Xmpz_fSg@mail.gmail.com>

On 05/30/2018 08:48 AM, nageswara Bandla wrote:
> 
> 
> On Tue, May 29, 2018 at 6:15 PM, Adrian Klaver 
> <adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>> wrote:
> 
>     On 05/29/2018 03:57 PM, nageswara Bandla wrote:
> 
>         #1. Windows:
> 
>         My guess because the LocalSystem user does not have permissions
>         on your:
>         %APPDATA%/postgresql/pgpass.co <http://pgpass.co;
>         <http://pgpass.co>nf
>         file. This seems to be confirmed by it working when you run
>         pgagent as the login user.
>         Also:
>         passfile
>               Specifies the name of the file used to store passwords
>         (see Section 33.15). Defaults to ~/.pgpass, or
>         %APPDATA%\postgresql\pgpass.co <http://pgpass.co;
>         <http://pgpass.co>nf on Microsoft Windows. (No error is reported
>         if this file does not exist.)
> 
> 
>         Does that mean we can not use pgagent (when installed)  as a 
>         "LocalSystem" service account and define PGPASSFILE to a valid
>         accessible location. ?
> 
> 
>     Not sure as I do not use Windows much and do not have a good handle
>     on how it handles permissions. You might try raising an issue below
>     to see if you can get some guidance:
> 
> 
> 
> Thank you Adrian, let me also try to raise an issue there and see.
> 

> 
> 
> I am running pgagent command from postgres system user account where 
> .pgpass is setup.
> 
> It’s definitely not a library issue. Since the same pgagent command that 
> I gave earlier is working fine by  appending  “password=secret” at the 
> end in pgagent command line.

That in of itself does not eliminate library issues as supplying the 
password removes the need for libpq to search for a .pgpass or env 
variable specifying the file or the password itself and that is where 
pgagent seems to be having the problem. This is more of a comment for 
future troubleshooting then the present as reducing the Postgres 
versions to one eliminates library issues.

> 
> */usr/bin/pgagent_96 -f -l 2 hostaddr=127.0.0.1 dbname=linuxpostgresdb 
> user=postgres port=5432 password=secret*

> 
> *
> *
> 
> Anyway, I have tried your suggestion to clean up old postgres libraries 
> and tried to keep only one version of postgres libraries exist in the 
> entire system. It’s still same issue.
> 
> And I am trying in the same machine where the postgres is installed.
> 
> 
> 
> 
> 
>         When I run psql from postgres user; It works fine.
>         *
>         *
>         */usr/bin/pgagent_96 -f -l 2 hostaddr=127.0.0.1
>         dbname=linuxpostgresdb user=postgres port=5432*
>         DEBUG: Creating primary connection
>         DEBUG: Connection Information:
>         DEBUG:      user         : postgres
>         DEBUG:      port         : 5432
>         DEBUG:      host         : 127.0.0.1
>         DEBUG:      dbname       : linuxpostgresdb
>         DEBUG:      password     :
>         DEBUG:      conn timeout : 0
>         DEBUG: Connection Information:
>         DEBUG:      user         : postgres
>         DEBUG:      port         : 5432
>         DEBUG:      host         : 127.0.0.1
>         DEBUG:      dbname       : linuxpostgresdb
>         DEBUG:      password     :
>         DEBUG:      conn timeout : 0
>         DEBUG: Creating DB connection: user=postgres port=5432
>         hostaddr=127.0.0.1 dbname=linuxpostgresdb
>         WARNING: Couldn't create the primary connection (attempt 1):
>         fe_sendauth: no password supplied
>         DEBUG: Clearing all connections
>         DEBUG: Connection stats: total - 1, free - 0, deleted - 1
> 
>         *# psql command is running fine:*
>         psql -h 127.0.0.1 -d linuxpostgresdb -U postgres
> 
>         psql (8.4.20, server 9.6.6)
>         WARNING: psql version 8.4, server version 9.6.
>                    Some psql features might not work.
>         Type "help" for help.
> 
>         linuxpostgresdb=#
> 
> 
> 
> 
> 
> 
>     -- 
>     Adrian Klaver
>     adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com




view thread (20+ messages)  latest in thread

Message-ID: <98dc353c-8d69-49d6-5ee9-01f53344d284@aklaver.com>
Permalink:  ../98dc353c-8d69-49d6-5ee9-01f53344d284@aklaver.com/
Also on:    postgresql.org/message-id/98dc353c-8d69-49d6-5ee9-01f53344d284@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, nag.bandla@gmail.com
  Subject: Re: Pgagent is not reading pgpass file either in Windows or Linux.
  In-Reply-To: <98dc353c-8d69-49d6-5ee9-01f53344d284@aklaver.com>
  References: <CADJadRDCoHALsJQv8ySQiO2QdgWnfqVL+iX-v72QxA6pFtgYtg@mail.gmail.com> <5595335e-32e8-80da-9c65-8d79fce554a7@aklaver.com> <CADJadRDZLZyRuD20dDy-LkV9hrZhKkzObQYHHWDTKt1iZEDtHQ@mail.gmail.com> <12119160-c746-926a-110a-f82a0e769728@aklaver.com> <CADJadRBkfokPYGM=+ptGpK+VGF0ag3iOB=4zVDOR15Xmpz_fSg@mail.gmail.com> <98dc353c-8d69-49d6-5ee9-01f53344d284@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox