Enable Access for remote users in PostgreSQL

By default, remote access is disabled for security measure. We can enable this by editing posgresql.conf and pg_hba.conf files.

Steps: Enable Access for remote users in PostgreSQL

1. Go to Configation files(posgresql.conf and pg_hba.conf) location:/etc/postgresql/9.5/main

2. postgres@ubuntu$ cd /etc/postgresql/9.5/main

postgres@ubuntu:/etc/postgresql/9.5/main$ ls -ltrh
total 56K
-rw-r–r– 1 postgres postgres 378 May 9 00:26 start.conf
-rw-r–r– 1 postgres postgres 143 May 9 00:26 pg_ctl.conf
-rw-r—– 1 postgres postgres 1.6K May 9 00:26 pg_ident.conf
-rw-r–r– 1 postgres postgres 315 May 9 00:26 environment
-rw-r–r– 1 postgres postgres 22K May 9 00:26 postgresql.conf
-rw-r—– 1 postgres postgres 4.6K May 12 09:31 pg_hba.conf
-rw-r—– 1 postgres postgres 4.6K May 12 20:28 pg_hba.conf.back
postgres@ubuntu:/etc/postgresql/9.5/main$ pwd
/etc/postgresql/9.5/main

3. Edit the following line in postgres.conf file.

listen_addresses=’*’

4. Change method from peer to md5, which allow access to all databases for all users with an encrypted password from any ip addresses.

# TYPE DATABASE USER ADDRESS METHOD host all all 0.0.0.0/0 md5

Related Posts

CheapSexCams
Responses are currently closed, but you can trackback from your own site.

Comments are closed.

Powered by k2schools
%d bloggers like this: