#!/bin/bash # postgres 계정 비밀번호 변경 echo -n "ALTER USER postgres WITH PASSWORD '" > /tmp/__psql__.sql echo -n 'Pass@2rd' >> /tmp/__psql__.sql echo "'" >> /tmp/__psql__.sql chown postgres:postgres /tmp/__psql__.sql sudo -u postgres psql -f /tmp/__psql__.sql rm -f /tmp/__psql__.sql # 원격 연결 허용 sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/g" /var/lib/pgsql/11/data/postgresql.conf sed -i "s/host all all 127.0.0.1\/32 ident/host all all 0.0.0.0\/0 md5/g" /var/lib/pgsql/11/data/pg_hba.conf