Re: .pgpass not working ( centos7, pgagent_96 )

From: JaeWon Lee <thejaewon(at)gmail(dot)com>
To: Payal Singh <payal(at)omniti(dot)com>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: .pgpass not working ( centos7, pgagent_96 )
Date: 2017-10-18 10:21:00
Message-ID: CAC+TV7ELyQshsdTjYGKeKORFp7FVqhenjoVAHua4AG=xM2WDPw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Thanks ^^ I can log in to database like that.
But still I can not use my .pgpass.
I think this problem may be related to security context of .pgpass.
pgagent_96 or systemd may not be allowed to read .pgpass file ... ( Just
my guess ^^ )
I'm checking if pgagent_96 or systemd can read .pgpass.

[root(at)web bin]# su - postgres
-bash-4.2$ psql -h localhost -U postgres
psql (9.6.5)
postgres=#

[root(at)web frank]# ls -alZ .pgpass
-rw-------. postgres postgres unconfined_u:object_r:user_home_t:s0 .pgpass
[root(at)web frank]# ls -alZ /usr/bin/pgagent_96
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 /usr/bin/pgagent_96
[root(at)web frank]# ls -alZ /usr/lib/systemd/systemd
-rwxr-xr-x. root root system_u:object_r:init_exec_t:s0
/usr/lib/systemd/systemd
[root(at)web frank]# ls -alZ /var/lib/pgsql/9.6/data/pg_hba.conf
-rw-------. postgres postgres unconfined_u:object_r:postgresql_db_t:s0
/var/lib/pgsql/9.6/data/pg_hba.conf

2017-10-17 3:01 GMT+09:00 Payal Singh <payal(at)omniti(dot)com>:

> Just to be sure, you are able to login to the database from psql? psql -h
> localhost -U postgres ?
>
> Payal Singh,
> Database Administrator,
> OmniTI Computer Consulting Inc.
> Phone: 240.646.0770 x 253
>
> On Mon, Oct 16, 2017 at 12:23 PM, JaeWon Lee <thejaewon(at)gmail(dot)com> wrote:
>
>> Thanks ^^
>> I tested same thing for OS user 'root' (/root), 'postgres'
>> (/var/lib/pgsql ), and other two normal users who has home directory in
>> /home.
>> But I got same error.
>> ---- [ pgagent_96.log ]
>> WARNING: Couldn't create the primary connection (attempt 10):
>> fe_sendauth: no password supplied
>> ERROR: Stopping pgAgent: Couldn't establish the primary connection with
>> the database server.
>>
>>
>> 2017-10-17 0:17 GMT+09:00 David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>:
>>
>>> On Mon, Oct 16, 2017 at 1:02 AM, JaeWon Lee <thejaewon(at)gmail(dot)com> wrote:
>>>
>>>>
>>>> 5. Checked my .pgpass file. ( .pgpass is in frank's home directory.
>>>> /home/frank )
>>>>
>>> ​
>>> Frankly[1], this is probably your problem. pgAgent is most likely not
>>> running as user "frank". You need to identify what O/S user the
>>> application is running under and place the .pgpass file in that user's home
>>> directory.
>>>
>>> David J.
>>> ​
>>> 1. pun intended...
>>>
>>>
>>
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Hartranft, Robert M. (GSFC-423.0)[RAYTHEON CO] 2017-10-18 20:00:14 question on hash joins
Previous Message Scott Marlowe 2017-10-17 19:54:20 Re: Autovacuum after bulk data insert(millions!)