RETRO.COM.ES

Web sobre informática retro y vintage

Herramientas de usuario

Herramientas del sitio


crux24:pg-remoto

Acceso remoto en PostgreSQL

Traducir, elaborar y reformatear el texto.

Modify the PostgreSQL configuration file

Open the PostgreSQL configuration file postgresql.conf

Then, find the line #listen_addresses = 'localhost' and uncomment it (remove the # character at the beginning of the line).

listen_addresses = '*'

Next, change the value of listen_addresses to *. This allows PostgreSQL to listen on all available IP addresses. Alternatively, you can specify a specific IP address or a range of IP addresses that are allowed to connect to the server.

Modify the pg_hba.conf file

Open the pg_hba.conf

Take the following section:

# IPv4 local connections: 
host    all             all             127.0.0.1/32            trust

And modify it this way:

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

Allow port 5432 through the firewall

To enable traffic on port 5432 through the firewall, execute the following command: sudo ufw allow 5432/tcp

Restart PostgreSQL

Run the following command to restart PostgreSQL: /etc/rc.d/postgresql restart

Cambiar la clave del usuario postgres

Ejecutar psql en el servidor y luego el comando indicado:

root@server:~ # su - postgres
postgres@server:~ $ psql 
psql (9.6.24)
Type "help" for help.

postgres=# ALTER USER postgres WITH PASSWORD 'xxxxx';
ALTER ROLE
postgres=# \q
postgres@server:~ $ exit
logout
root@server:~ # _

©2017-2024, jCæsar Contacto

Herramientas de la página