pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Nu-B here
6+ messages / 5 participants
[nested] [flat]

* Nu-B here
@ 2023-07-20 00:36 Amn Ojee Uw <amnojeeuw@gmail.com>
  2023-07-20 00:54 ` Re: Nu-B here Tom Lane <tgl@sss.pgh.pa.us>
  2023-07-20 00:55 ` Re: Nu-B here Maciek Sakrejda <m.sakrejda@gmail.com>
  2023-07-20 06:32 ` Re: Nu-B here Alban Hertroys <haramrae@gmail.com>
  0 siblings, 3 replies; 6+ messages in thread

From: Amn Ojee Uw @ 2023-07-20 00:36 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

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?

Thanks in advance!

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Nu-B here
  2023-07-20 00:36 Nu-B here Amn Ojee Uw <amnojeeuw@gmail.com>
@ 2023-07-20 00:54 ` Tom Lane <tgl@sss.pgh.pa.us>
  2 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2023-07-20 00:54 UTC (permalink / raw)
  To: Amn Ojee Uw <amnojeeuw@gmail.com>; +Cc: pgsql-general@lists.postgresql.org

Amn Ojee Uw <amnojeeuw@gmail.com> writes:
> 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.*

This is normal if you launch psql via "sudo -u postgres" in a directory
that the postgres user doesn't have permissions to read/chdir to.
psql will still start, but its working directory will not be what
you'd expect, so commands that involve local filesystem access might
misbehave.

We have a fix for this error report in the upcoming v16, but psql commands
that involve local filesystem access will still not act very nicely if
psql can't read your directory.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Nu-B here
  2023-07-20 00:36 Nu-B here Amn Ojee Uw <amnojeeuw@gmail.com>
@ 2023-07-20 00:55 ` Maciek Sakrejda <m.sakrejda@gmail.com>
  2 siblings, 0 replies; 6+ messages in thread

From: Maciek Sakrejda @ 2023-07-20 00:55 UTC (permalink / raw)
  To: Amn Ojee Uw <amnojeeuw@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On Wed, Jul 19, 2023, 17:36 Amn Ojee Uw <amnojeeuw@gmail.com> 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

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Nu-B here
  2023-07-20 00:36 Nu-B here Amn Ojee Uw <amnojeeuw@gmail.com>
@ 2023-07-20 06:32 ` Alban Hertroys <haramrae@gmail.com>
  2023-07-20 14:41   ` Re: Nu-B here Adrian Klaver <adrian.klaver@aklaver.com>
  2 siblings, 1 reply; 6+ messages in thread

From: Alban Hertroys @ 2023-07-20 06:32 UTC (permalink / raw)
  To: Amn Ojee Uw <amnojeeuw@gmail.com>; +Cc: pgsql-general <pgsql-general@lists.postgresql.org>


> On 20 Jul 2023, at 02:36, Amn Ojee Uw <amnojeeuw@gmail.com> wrote:
> 
> After this command 'sudo -u postgres psql'
> I get this message : 
> could not change directory to "/home/my_account": Permission denied

What’s the reason that you’re using the OS user postgres?

If you’re simply trying to connect to the database named postgres as database user postgres, you can instead use the command 'psql -U postgres postgres’.

Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.






^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Nu-B here
  2023-07-20 00:36 Nu-B here Amn Ojee Uw <amnojeeuw@gmail.com>
  2023-07-20 06:32 ` Re: Nu-B here Alban Hertroys <haramrae@gmail.com>
@ 2023-07-20 14:41   ` Adrian Klaver <adrian.klaver@aklaver.com>
  2023-07-25 22:10     ` Re: Nu-B here Amn Ojee Uw <amnojeeuw@gmail.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Adrian Klaver @ 2023-07-20 14:41 UTC (permalink / raw)
  To: Alban Hertroys <haramrae@gmail.com>; Amn Ojee Uw <amnojeeuw@gmail.com>; +Cc: pgsql-general <pgsql-general@lists.postgresql.org>

On 7/19/23 23:32, Alban Hertroys wrote:
> 
>> On 20 Jul 2023, at 02:36, Amn Ojee Uw <amnojeeuw@gmail.com> wrote:
>>
>> After this command 'sudo -u postgres psql'
>> I get this message :
>> could not change directory to "/home/my_account": Permission denied
> 
> What’s the reason that you’re using the OS user postgres?

Because the Debian/Ubuntu packaging sets up pg_hba.conf to use peer auth 
for local connections and the only database user created is postgres.

See:

https://ubuntu.com/server/docs/databases-postgresql

for more information.

> 
> If you’re simply trying to connect to the database named postgres as database user postgres, you can instead use the command 'psql -U postgres postgres’.


> 
> Alban Hertroys
> --
> If you can't see the forest for the trees,
> cut the trees and you'll find there is no forest.
> 
> 
> 

-- 
Adrian Klaver
adrian.klaver@aklaver.com






^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Nu-B here
  2023-07-20 00:36 Nu-B here Amn Ojee Uw <amnojeeuw@gmail.com>
  2023-07-20 06:32 ` Re: Nu-B here Alban Hertroys <haramrae@gmail.com>
  2023-07-20 14:41   ` Re: Nu-B here Adrian Klaver <adrian.klaver@aklaver.com>
@ 2023-07-25 22:10     ` Amn Ojee Uw <amnojeeuw@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Amn Ojee Uw @ 2023-07-25 22:10 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org; +Cc: haramrae@gmail.com

Please note the following :
/psql (12.15 (Debian 12.15-1.pgdg120+1
/Thanks in advance
//

On 7/20/23 10:41 a.m., Adrian Klaver wrote:
> On 7/19/23 23:32, Alban Hertroys wrote:
>>
>>> On 20 Jul 2023, at 02:36, Amn Ojee Uw <amnojeeuw@gmail.com> wrote:
>>>
>>> After this command 'sudo -u postgres psql'
>>> I get this message :
>>> could not change directory to "/home/my_account": Permission denied
>>
>> What’s the reason that you’re using the OS user postgres?
>
> Because the Debian/Ubuntu packaging sets up pg_hba.conf to use peer 
> auth for local connections and the only database user created is 
> postgres.
>
> See:
>
> https://ubuntu.com/server/docs/databases-postgresql
>
> for more information.
>
>>
>> If you’re simply trying to connect to the database named postgres as 
>> database user postgres, you can instead use the command 'psql -U 
>> postgres postgres’.
>
>
>>
>> Alban Hertroys
>> -- 
>> If you can't see the forest for the trees,
>> cut the trees and you'll find there is no forest.
>>
>>
>>
>

^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2023-07-25 22:10 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-07-20 00:36 Nu-B here Amn Ojee Uw <amnojeeuw@gmail.com>
2023-07-20 00:54 ` Tom Lane <tgl@sss.pgh.pa.us>
2023-07-20 00:55 ` Maciek Sakrejda <m.sakrejda@gmail.com>
2023-07-20 06:32 ` Alban Hertroys <haramrae@gmail.com>
2023-07-20 14:41   ` Adrian Klaver <adrian.klaver@aklaver.com>
2023-07-25 22:10     ` Amn Ojee Uw <amnojeeuw@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox