pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: noloader@gmail.com
Cc: pgsql-general@lists.postgresql.org
Subject: Re: How to make PostreSQL utilities honor home directories?
Date: Thu, 01 Sep 2022 18:16:14 -0400
Message-ID: <780195.1662070574@sss.pgh.pa.us> (raw)
In-Reply-To: <CAH8yC8kOj0pmHF1RbK2Gb2t4YCcNG-5h0TwZ7yxk3Hzw6C0Otg@mail.gmail.com>
References: <CAH8yC8kOj0pmHF1RbK2Gb2t4YCcNG-5h0TwZ7yxk3Hzw6C0Otg@mail.gmail.com>

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

You've left out quite a lot of information here ... like what
connection that directory has to do with anything.  Is it your
current directory when you invoke this command?

If so, a plausible explanation is that psql is trying to chase a
symlink to somewhere, which involves some chdir's so it can resolve
the symlink correctly, and afterwards it has to change back to
where it started --- which would fail if it can't look up that
directory.

Why it's trying to resolve a symlink isn't apparent though.
Is the "psql" you're invoking a symlink to somewhere?

			regards, tom lane





view thread (14+ messages)  latest in thread

Message-ID: <780195.1662070574@sss.pgh.pa.us>
Permalink:  ../780195.1662070574@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/780195.1662070574@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, noloader@gmail.com
  Subject: Re: How to make PostreSQL utilities honor home directories?
  In-Reply-To: <780195.1662070574@sss.pgh.pa.us>
  References: <CAH8yC8kOj0pmHF1RbK2Gb2t4YCcNG-5h0TwZ7yxk3Hzw6C0Otg@mail.gmail.com> <780195.1662070574@sss.pgh.pa.us>

* 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