Re: BUG #16915: use psql have error "could not change directory to "/root": Permission denied"

From: "Euler Taveira" <euler(at)eulerto(dot)com>
To: 陈剑华 <370619197(at)qq(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16915: use psql have error "could not change directory to "/root": Permission denied"
Date: 2021-03-08 12:40:04
Message-ID: 49cf86fd-f302-40fb-a408-0b33538d825e@www.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Mar 5, 2021, at 6:34 AM, 陈剑华 wrote:
> Of course, I can
> Centos7 ~ # sudo -u postgres -i psql
> This account is currently not available.
I tested it and it prints the "permission denied" message. IMO your setup is
broken. The PGDG packages create a postgres user with a shell. The routine that
prints this message expects to chdir the current directory to validate the psql
path, however, due to sudo withouth a shell it cannot chdir the current
directory. It cannot happen if you use a shell (sudo -i).

> this is my issue
> https://github.com/ANXS/postgresql/issues/499
>
> my passwd:
> postgres:x:1000:1000::/var/lib/postgres:/sbin/nologin
PGDG packages create postgres user with a shell.

[root(at)centos7 ~]# grep postgres /etc/passwd
postgres:x:26:26:PostgreSQL Server:/var/lib/pgsql:/bin/bash

Since, your setup is broken and that psql works even after this error, it is
hard to convince someone to fix this minor issue. I wouldn't even classify it
as a bug.

--
Euler Taveira
EDB https://www.enterprisedb.com/

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Sven Klemm 2021-03-08 14:25:15 Re: Hex escapes in strings only support ASCII range
Previous Message Vilem Benjamin Liepelt 2021-03-08 11:42:35 Hex escapes in strings only support ASCII range