Re: BUG #18054: Permission denied.

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: arasopero(dot)1(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18054: Permission denied.
Date: 2023-08-14 03:00:14
Message-ID: 20230814030014.xc4pbmdlfaxvpmcg@jrouhaud
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

On Sun, Aug 13, 2023 at 04:26:48AM +0000, PG Bug reporting form wrote:
> The following bug has been logged on the website:
>
> I can not make backup and restoration of my db by this issues:
> baap(at)baap-notebookpc:~$ sudo su postgres
> [sudo] password for baap:
> postgres(at)baap-notebookpc:/home/baap$ psql
> could not change directory to "/home/baap": Permission denied
> psql (15.4 (Ubuntu 15.4-1.pgdg22.04+1))
>
> Can you help me to solve this situation?

Are you talking about the "Permission denied" line? This is not a bug, just an
indication that the current OS user doesn't have permission to use the given
directory, and doesn't prevent you from using psql. Of course it means that
the postgres OS user can't write data in /home/baap, and won't be able to e.g.
save the psql history, but that's something enforced at the OS level not
something postgres can change.

You could either use "sudo su - postgres" to simulate a full login and
therefore change the directory to postgres' home directory, then any if you try
to write things using a relative path it should work, provided that the
postgres OS user is correctly configured. Otherwise you need to specify
absolute paths, pointing to directories where the postgres OS user have enough
permissions for what you want to do.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2023-08-14 03:27:19 Re: BUG #18054: Permission denied.
Previous Message Michael Paquier 2023-08-14 02:08:40 Re: BUG #17928: Standby fails to decode WAL on termination of primary