Although this is not recommended, there might be scenarios where there are no other options.

An example is an analysis software which doesn’t give the capability to connect via SSH. I came across this scenario when someone wanted to use QLik. Although this has a lot of capabilities, but when something like this is required, I’d rather use the open source and free Metabase.

Get Postgres config file location

From the postgres prompt.

postgres> psql -U postgres -c 'SHOW config_file

Modify the postgresql.conf file

From the above command the config file might be in –

/etc/postgresql/10/main/postgresql.conf

In this we modify the the following line

listen_addresses = '*'

Modify pg_hba.conf file

This is located in the same folder as the file above.

/etc/postgresql/10/main/pg_hba.conf

Add the following lines –

# IPv4 external connections:
host    all             all             0.0.0.0/0               md5

# IPv6 external connections:
host    all             all             ::/0                    md5

Restart Postgres

$> /etc/init.d/postgresql restart