Re: How to make PostreSQL utilities honor home directories?

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: How to make PostreSQL utilities honor home directories?
Date: 2022-09-01 22:06:02
Message-ID: a82f21a2-f67a-7c4a-d23e-c1a9a5caa335@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 9/1/22 3:01 PM, Jeffrey Walton wrote:
> Hi Everyone,
>
> We are having a heck of a time getting PostreSQL utilities to honor
> home directories. For example, when I execute this script:
>
> sudo -H -u postgres PGPASSWORD=${password} \
> psql -h "${hostname}" -U "${username}" -d "${database}" \
> --command="..."

Why are you doing this in the first place?

Just do:

psql -h "${hostname}" -U "${username}" -d "${database}" \
--command="..."

and use .pgpass:

https://www.postgresql.org/docs/14/libpq-pgpass.html

or set PGPASSWORD in your home env.

>
> It produces failures:
>
> could not change directory to "/home/jwalton/godojo": Permission denied
>
> /home/jwalton is my home directory. The postgres user does not have
> access to my stuff. The postgres user's home directory is
> /var/lib/pgsql .
>
> Reading through the `psql --help` options and searching on the web is
> not turning up any hits.
>
> We are also observing the errors when using pg_isready .
>
> How to make PostreSQL utilities honor home directories?
>
> Thanks in advance.
>
> Jeff
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2022-09-01 22:16:14 Re: How to make PostreSQL utilities honor home directories?
Previous Message Jeffrey Walton 2022-09-01 22:01:02 How to make PostreSQL utilities honor home directories?