can't access postgres file pg_hba.conf
First note down the location of pg_hba.conf
on your system. If you don't know it but you can connect, connect to Pg with PgAdmin-III or psql
and run:
SHOW hba_file;
to get the location of pg_hba.conf
. It's location is pretty standard; on Ubuntu it'll be in /etc/postgresql/[major.minor]/main/pg_hba.conf
eg /etc/postgresql/9.1/main/pg_hba.conf
. On most other distros it'll be under /var/lib/pgsql/
or /var/lib/postgresql
, either directly or in versioned directory.
To edit this file you must specify the full path or change directory to its location first. Say:
sudo vi /etc/postgresql/9.1/main/pg_hba.conf
If you prefer a friendlier text editor:
sudo nano /etc/postgresql/9.1/main/pg_hba.conf
or replace "nano" with your preferred editor, like gedit
.
Once you save your changes, remember to reload the PostgreSQL service to have them take effect. On Ubuntu you want:
pg_ctlcluster 9.1 main reload