HOWTO? Permissions for user to access a single db - Mailing list pgsql-general

From Damian Carey
Subject HOWTO? Permissions for user to access a single db
Date
Msg-id CA+QCafdWu7Qd13wRdjdyubhCtUMhDsuDUZLHYNA7jvqhWjdxbQ@mail.gmail.com
Whole thread Raw
Responses Re: HOWTO? Permissions for user to access a single db
Re: HOWTO? Permissions for user to access a single db
List pgsql-general
Hi,

Amateur question here :-{  Despite using Postgres for 15 years it's always been locked safely inside a VPS with Hibernate on top powering a Java web app. Each customer is on a separate VPS which typically has ~500k rows over about 30 tables. Basic but very effective.
 
We now need to provide access to an associate company to a single database (3 tables, ~10k rows) that our java app writes to (not JDBC, via Hibernate). We have a nice SSH tunnel coming in, but they cannot view the shared database (yes, I'm an amateur).

I'm just looking for beginners suggestions to get this db visible to this user so we can continue our trials. They have their own Linux user login, and their SSH access gives them access to port 5432 and nothing else. They can see postgres, but no databases are visible.

Ubuntu 22.04
PG14
Their Linux user (say): "user2" / "theuser2linuxpwd"
Postgres user (say): "user2" / "myuser2pwd"
Postgres db they access (say): "mytransferdb" 

In psql I did:
create user user2 with encrypted password 'myuser2pwd';
grant all privileges on database mytransferdb to user2;

I didn't think it was a pg_hba.conf issue because via SSH tunnel they appear inside linux as if localhost (I think?).

After you stop laughing/crying, can anyone guide me?

Huge thx
-Damian

pgsql-general by date:

Previous
From: Peter
Date:
Subject: Re: [Testcase] Queries running forever, because of wrong rowcount estimate
Next
From: Tom Lane
Date:
Subject: Re: HOWTO? Permissions for user to access a single db