2

I am running:

version
-----------------------------------------------------------------------------------------------------
PostgreSQL 9.4.11 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2, 64-bit
(1 row)

and:

pgAdmin III 1.22.2

on the same:

Description: Ubuntu 14.04.5 LTS
Release: 14.04

I can open the postgresql.conf configuration file with pgAdmin but not the pg_hba.conf configuration file.

pgAdmin III pg_hba.conf error message

Both files are in the same directory (/etc/postgresql/9.4/main):

-rw-r----- 1 postgres postgres  4641 Jun 10  2016 pg_hba.conf
-rw-r--r-- 1 postgres postgres 21501 Jun 10  2016 postgresql.conf

but I have noticed that the two configuration files have different permissions. I haven't modified the permissions of pg_hba.conf to make them different from those of postgresql.conf.

Are the permissions of these files different by default? Is there are reason why the pg_hba.conf has more restricted read permissions? Can I go ahead and modify the permissions of pg_hba.conf?

1 Answer 1

1

It's not clear what is the point in doing that, but if you're an admin you can do chmod o+r pg_hba.conf to let a non-admin read it.

There are two ways in pgAdmin3 to access those files:

  • by reading the file system (if it runs on the same host than the server). This corresponds to the File->Open *.conf commands. With that method, permission-wise, pgAdmin is not special, it's like a text editor or a pager.
  • through the DB connection, with Tools->Server configuration. This requires the adminpack contrib module installed server-side. In the case of Ubuntu, I'm not sure it would work because the configuration files are not inside the data directory below /var, they're under /etc/... and the server-side functions involved are not supposed to reach anything outside the data directory. But if/when this method does work, it's the postgres process that reads the files, so the permissions shown in the question are good enough.
2
  • I was able to access the pg_hba.conf with pgAdmin reading the file system only after I gave other the read permission. Still not sure (& curious) why they were different in the first place. I am afraid Tools → Server Configuration → pg_hba.conf does not work with this set up. Which I find odd as I can work with postgresql.conf without any problems using both of the ways that you have outlined above.
    – dw8547
    May 11, 2017 at 8:05
  • as per your second point & this post postgresql.org/message-id/…, it should not be possible to edit either pg_hba.conf or postgresql.conf so I'm finding this even odder. (The extension adminpack is installed in all the DBs.)
    – dw8547
    May 11, 2017 at 8:21

Your Answer

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

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