| | 266 | == Rewmote Access == |
| | 267 | Say that you want to provide access for an external reporting tool. |
| | 268 | |
| | 269 | Add the user account: |
| | 270 | {{{ |
| | 271 | su postgres |
| | 272 | psql |
| | 273 | CREATE USER reporter WITH PASSWORD 'mypassword'; |
| | 274 | \q |
| | 275 | exit |
| | 276 | su -c - postgres "psql -q -d sahana -c 'GRANT CONNECT ON DATABASE sahana TO reporter;'" |
| | 277 | su -c - postgres "psql -q -d sahana -c 'GRANT SELECT ON ALL TABLES IN SCHEMA public TO reporter;'" |
| | 278 | }}} |
| | 279 | |
| | 280 | Allow remote access: |
| | 281 | {{{ |
| | 282 | vim /etc/postgresql/9.4/main/postgresql.conf |
| | 283 | listen_addresses = '*' |
| | 284 | |
| | 285 | vim /etc/postgresql/9.4/main/pg_hba.conf |
| | 286 | host sahana reporter x.x.x.x/32 md5 |
| | 287 | |
| | 288 | /etc/init.d/postgresql restart |
| | 289 | }}} |
| | 290 | |
| | 291 | NB Also remember any network firewll, e.g. on Amazon EC2, amend the Security Group. |
| | 292 | |