0

Basic question:

what I'm reading describes how to create linux users in parallel with postgresql roles.

However, I don't see the value in creating any of these users in linux - I just want to create a postgresql role - and login to that from my application - or when running psql from the terminal using my own login - but in the role of the project.

e.g. - if the project is 'foo' - I want to have the psql -U foo, but no 'foo' user under linux. After all - what's the point? It's a role purely for psql - not for linux.

Is this possible in Postgresql - and if so - how do I do this?

I've trivially created a postgresql user role - without a linux account - but then I cannot ever -U role, as I get an error around peer authentication.

So - I assume I need to change how postgresql is handling permissions - and that's where I'm too green with postgresql to know what I'm doing there.

Perhaps a pointer to a clear little document discussing authentication modes or connection modes and setup for postgresql would help me resolve my issues?

2
  • "a clear little document discussing authentication modes" - postgresql.org/docs/current/client-authentication.html
    – user1822
    Commented Aug 6, 2019 at 15:03
  • 1
    "what I'm reading describes how to create linux users in parallel with postgresql roles." What are you reading? Please don't make us guess.
    – jjanes
    Commented Aug 6, 2019 at 15:41

2 Answers 2

2

Either don't use peer authentication, or do use it but with a user mapping (specified in pg_ident.conf) which declares which db users each OS user is allowed to connect as.

4

You need to update your pg_hba.conf to allow for a non-peer authentication method.

It’s perfectly normal to create roles which don’t have OS accounts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.