Running psql commands from a remote location & pg_hba.conf? - Mailing list pgsql-novice

From Birchall, Austen
Subject Running psql commands from a remote location & pg_hba.conf?
Date
Msg-id 4E154FB60786D74BB4DFDC97BF991CAC07602A@EXXCMPD1DAG2.cmpd1.metoffice.gov.uk
Whole thread Raw
Responses Re: Running psql commands from a remote location & pg_hba.conf?
List pgsql-novice
I have a monitor user that does a SSH from a remote location onto a database's host then runs commands  of the form:

/usr/bin/psql -c "SELECT COUNT(*) FROM pg_stat_activity; ;" -U monitor -d db1 -q -A -t

The current pg_hba.conf  is


# IPv4 local connections:
host    all         all         123.0.0.1/32          trust
which is far from ideal!

Am I right to presume that I have to change pg_hba.conf to

host    db1    monitor        123.0.0.1/32    trust
host     db1    user1        123.0.0.1/32    ident
host    db1    user2        123.0.0.1/32    ident

then continue this format with individual entries for all the users in db1?

Or is there a 'better' way of running psql commands from a remote location?

Thanks

Austen

Austen Birchall  Senior Database Administrator, Met Office


pgsql-novice by date:

Previous
From: Luca Ferrari
Date:
Subject: Re: General 'big data' advice....
Next
From: Luca Ferrari
Date:
Subject: Re: Running psql commands from a remote location & pg_hba.conf?