From: Peter J. Holzer <hjp-pgsql@hjp.at>
To: pgsql-general@lists.postgresql.org
Subject: Re: How to make PostreSQL utilities honor home directories?
Date: Fri, 2 Sep 2022 13:34:38 +0200
Message-ID: <20220902113438.5bdmtet4fazofmpr@hjp.at> (raw)
In-Reply-To: <CAH8yC8nPQ95EYCU2SqwayOSNjQ03+yHifH-OXD_mVjNbEk_=bQ@mail.gmail.com>
References: <CAH8yC8kOj0pmHF1RbK2Gb2t4YCcNG-5h0TwZ7yxk3Hzw6C0Otg@mail.gmail.com>
<780195.1662070574@sss.pgh.pa.us>
<20220902002307.qrxhyeexronkdgsr@hjp.at>
<CAH8yC8nPQ95EYCU2SqwayOSNjQ03+yHifH-OXD_mVjNbEk_=bQ@mail.gmail.com>
On 2022-09-01 20:49:56 -0400, Jeffrey Walton wrote:
> On Thu, Sep 1, 2022 at 8:23 PM Peter J. Holzer <hjp-pgsql@hjp.at> wrote:
> >
> > On 2022-09-01 18:16:14 -0400, Tom Lane wrote:
> > > Jeffrey Walton <noloader@gmail.com> writes:
> > > > 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="..."
> > >
> > > > It produces failures:
> > >
> > > > could not change directory to "/home/jwalton/godojo": Permission denied
> > I get the same behaviour. So it seems that psql changes to its basedir
> > and then can't change back again.
>
> I guess there is no way to avoid the problem.
Changing to /tmp (or some other directory accessible by posgres) before
running the script would avoid it.
As would (temporarily) changing the permissions of the diretor(y/ies).
Or not using sudo at all (see other messages).
hp
--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
Attachments:
signature.asc (application/pgp-signature, 832B) download
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: hjp-pgsql@hjp.at
Subject: Re: How to make PostreSQL utilities honor home directories?
In-Reply-To: <20220902113438.5bdmtet4fazofmpr@hjp.at>
References: <CAH8yC8kOj0pmHF1RbK2Gb2t4YCcNG-5h0TwZ7yxk3Hzw6C0Otg@mail.gmail.com> <780195.1662070574@sss.pgh.pa.us> <20220902002307.qrxhyeexronkdgsr@hjp.at> <CAH8yC8nPQ95EYCU2SqwayOSNjQ03+yHifH-OXD_mVjNbEk_=bQ@mail.gmail.com> <20220902113438.5bdmtet4fazofmpr@hjp.at>
* 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