On Wed, Jul 19, 2023, 17:36 Amn Ojee Uw <amnojeeuw@xxxxxxxxx> wrote:
After this command 'sudo -u postgres psql'
I get this message :
could not change directory to "/home/my_account": Permission denied
psql (12.15 (Debian 12.15-1.pgdg120+1))
Type "help" for help.I tried using help, but to no avail.
What am I doing wrong?
It looks like you're hitting a non-fatal error at some point during psql startup when you're running as the "postgres" user. It seems to be a permissions issue. Do you still get the error if you run
sudo -u postgres psql --no-psqlrc
?
You may also want to create a Postgres user (possibly a superuser) matching your operating system user if you have not already done so to avoid having to deal with sudo for connecting.
Thanks
Maciek