Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata
cat << 'EOL' >postgresql_port_listen.sh
systemctl stop postgresql
psqlver=10

#listen_addresses = '*'
sed -i '/listen_addresses/s/^#//g' /etc/postgresql/$psqlver/main/postgresql.conf 
sed -i -e 's/localhost/*/g' /etc/postgresql/$psqlver/main/postgresql.conf
cat /etc/postgresql/*/main/postgresql.conf  | grep listen

#port = 5432
#cat /etc/postgresql/$psqlver/main/postgresql.conf  | grep port
#sed -i -e 's/port = 5432/port = 45432/g' /etc/postgresql/$psqlver/main/postgresql.conf 
#cat /etc/postgresql/$psqlver/main/postgresql.conf  | grep port

#0.0.0.0/0 &  ::/0
cat /etc/postgresql/$psqlver/main/pg_hba.conf | grep host
sed -i -e 's|host    all             all             127.0.0.1/32            md5|host    all             all             0.0.0.0/0            peer|g' /etc/postgresql/$psqlver/main/pg_hba.conf 
sed -i -e 's|host    all             all             ::1/128                 md5|host    all             all             ::/0                 peer|g' /etc/postgresql/$psqlver/main/pg_hba.conf
cat /etc/postgresql/$psqlver/main/pg_hba.conf | grep host

systemctl start postgresql
netstat -nltp | grep postgre
EOL
chmod +x postgresql_port_listen.sh
./postgresql_port_listen.sh







  • No labels