Jump to content

[Solved] accessing my postgres database by second (read only) user


wambachr

Recommended Posts

Hi,

 

i'm using postgresql and php - it's running fine :)

 

I recently added a second database user (wambachr_osmuser) and granted r/o access to my tables. This userid/password will be visible to any user reading the php-script. But that is ok for me.

 

Now i'm getting error "Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL: no pg_hba.conf entry for host "65.19.143.6", user "wambachr_osmuser", database "wambachr_osm", SSL off in ..."

 

That is Tommies ip address and i think this should be added to pg_hba_conf too. Better using Tommys name instead of ip address, i think.

 

BUT i'm not 100% shure if this is the correct way, and you may tell me a better solution.

 

regards

walter aka wambacher

btw: "osm" stands for https://OpenStreetMap.org

Edited by wambachr
Link to comment
Share on other sites

sorry, no :(

$dbconn = pg_connect("host=127.0.0.1 dbname=wambachr_osm user=wambachr_osmuser password=public");


=> Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL: no pg_hba.conf entry for host "127.0.0.1", user "wambachr_osmuser", database "wambachr_osm", SSL off in /home/wambachr/public_html/getSoftware4.php on line 31

 

$dbconn = pg_connect("host=localhost dbname=wambachr_osm user=wambachr_osmuser password=public");


=> Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL: no pg_hba.conf entry for host "::1", user "wambachr_osmuser", database "wambachr_osm", SSL off in /home/wambachr/public_html/getSoftware4.php on line 31

 

$dbconn = pg_connect("host=tommy.heliohost.org dbname=wambachr_osm user=wambachr_osmuser password=public");

 

=> Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL: no pg_hba.conf entry for host "65.19.143.6", user "wambachr_osmuser", database "wambachr_osm", SSL off in /home/wambachr/public_html/getSoftware4.php on line 31


$dbconn = pg_connect("host=65.19.143.6 dbname=wambachr_osm user=wambachr_osmuser password=public");


=> Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL: no pg_hba.conf entry for host "65.19.143.6", user "wambachr_osmuser", database "wambachr_osm", SSL off in /home/wambachr/public_html/getSoftware4.php on line 31

 

$dbconn = pg_connect("host=wambachr.heliohost.org dbname=wambachr_osm user=wambachr_osmuser password=public");


=> Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL: no pg_hba.conf entry for host "65.19.143.6", user "wambachr_osmuser", database "wambachr_osm", SSL off in /home/wambachr/public_html/getSoftware4.php on line 31

even tried "no host"
 


$dbconn = pg_connect("dbname=wambachr_osm user=wambachr_osmuser password=public");


=> Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL: no pg_hba.conf entry for host "[local]", user "wambachr_osmuser", database "wambachr_osm", SSL off in /home/wambachr/public_html/getSoftware4.php on line 31

regards
walter

 

Testpage http://wambachr.heliohost.org/SoftwareWatchlist4.html will try to connect using "$dbconn = pg_connect("host=localhost dbname=wambachr_osm user=wambachr_osmuser password=public");  not working

 

switching to real db admin and his db password will work.

 

Edited by wambachr
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...