Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oU4wd-0007K6-Fo for pgsql-general@arkaria.postgresql.org; Fri, 02 Sep 2022 11:34:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oU4wb-0004Nh-VG for pgsql-general@arkaria.postgresql.org; Fri, 02 Sep 2022 11:34:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oU4wb-0004NY-Kv for pgsql-general@lists.postgresql.org; Fri, 02 Sep 2022 11:34:41 +0000 Received: from mail.hjp.at ([212.17.106.138] helo=rorschach.hjp.at) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oU4wY-0002ML-Rt for pgsql-general@lists.postgresql.org; Fri, 02 Sep 2022 11:34:40 +0000 Received: by rorschach.hjp.at (Postfix, from userid 1000) id 44D8379F9; Fri, 2 Sep 2022 13:34:38 +0200 (CEST) Date: Fri, 2 Sep 2022 13:34:38 +0200 From: "Peter J. Holzer" To: pgsql-general@lists.postgresql.org Subject: Re: How to make PostreSQL utilities honor home directories? Message-ID: <20220902113438.5bdmtet4fazofmpr@hjp.at> Mail-Followup-To: pgsql-general@lists.postgresql.org References: <780195.1662070574@sss.pgh.pa.us> <20220902002307.qrxhyeexronkdgsr@hjp.at> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="gl74c63vvomyvnsi" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --gl74c63vvomyvnsi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2022-09-01 20:49:56 -0400, Jeffrey Walton wrote: > On Thu, Sep 1, 2022 at 8:23 PM Peter J. Holzer wrote: > > > > On 2022-09-01 18:16:14 -0400, Tom Lane wrote: > > > Jeffrey Walton 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=3D${password} \ > > > > psql -h "${hostname}" -U "${username}" -d "${database}" \ > > > > --command=3D"..." > > > > > > > It produces failures: > > > > > > > could not change directory to "/home/jwalton/godojo": Permissio= n denied > > I get the same behaviour. So it seems that psql changes to its basedir > > and then can't change back again. >=20 > 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 --=20 _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" --gl74c63vvomyvnsi Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAmMR6k4ACgkQ8g5IURL+ KF2S7hAAkQrc+Yx0EMrcauu95FxZ13ARFLO/WqYgUeK9QM0rSZsDDift0UG+d8Gw 1KLvfc68vUxyXIO3FbFcRcWDNrX+yaVFro0zAKB/1dERXN3PLS4IUOmrxx10HnOU FPfCAuSckcfrGOCRKe7Y6w4tyNbesw/kb8VR+qRvSiRP1Dtv1IHLdT/s8Dh0BNz5 xKWeLLj/kcQrO1Sd85yTdQ9l1y+2KYRsZqJMWKloHc1UsZaurjUT5Agfh2BkgOyw l0/gwlCNhV3XKpKaoA+ZcfxVFZqBqTMZmzKFrcNgP45lXhCgR6msxWDhyCEaF/p5 s8WSt5yqe9y0i0oDWABvieMGs4WbRULg294g86/Hw5hdpBLZukksfmBCBdBkQlrV UgYp05IAI1YrfGVm3sY52EOgvuIRdSmMw0WWjB7mvQgFe7BGtKv+XKDbLKkmwIE9 EoJr6ADzOmBDLRMYP/A/lOU7EwKqyEMn3rxFcseQK+dNMGL2Utt639V1mfEF/Ocm m81wLcy2A/XxELsBQi/LvpmqhpNVc/vg1A9YGyPG6yuI/A3A3hkxTqBv0QnsT+PY gEjKE5mtY7mVeBuk8diAEn8k9n76i1ZCuzEhRWHtUYly0K+5C0ucgYC2yrSJHarL PrpFcfP9jtaR9Z06DfslbdypIEz6aDd55SHKb2FgXwxCadZ1yfk= =dxgQ -----END PGP SIGNATURE----- --gl74c63vvomyvnsi--