Re: How to make PostreSQL utilities honor home directories?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: How to make PostreSQL utilities honor home directories?
Date: 2022-09-02 00:51:02
Message-ID: 810388.1662079862@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Peter J. Holzer" <hjp-pgsql(at)hjp(dot)at> writes:
> However, the symlink doesn't seem to be the culprit. If I run
> % sudo -u postgres -H /usr/lib/postgresql/13/bin/psql
> (which is not a symlink)
> I get the same behaviour. So it seems that psql changes to its basedir
> and then can't change back again.

Ah --- looking closer at that code, it will chdir *before* checking
whether the target file is a symlink, which is probably unnecessarily
stupid. I'm wondering whether we could drop that logic altogether [1],
but that won't help you today.

I concur with the other person asking why you want to sudo to postgres
at all, though. It's generally safest if the client side isn't running
as the same user as the server.

regards, tom lane

[1] https://www.postgresql.org/message-id/797232.1662075573%40sss.pgh.pa.us

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeffrey Walton 2022-09-02 01:31:27 Re: How to make PostreSQL utilities honor home directories?
Previous Message Jeffrey Walton 2022-09-02 00:49:56 Re: How to make PostreSQL utilities honor home directories?