# Kill database process
Echo "Killing database process .."
Kill $ (pgrep postgres)>/dev/null 2> & 1
# Replace the md5 auth with trust for local ipv4 connections
Echo "Allowing all local IPV4 connections .."
Cp/opt/framework3/postgresql/data/pg_assist.conf/opt/framework3/postgresql/data/pg_assist.conf.bak
Cat/opt/framework3/postgresql/data/pg_assist.conf | sed-e's/host all 127.0.0.1 \/32 md5/host all 127.0.0.1 \/32 trust/'>/opt /framework3/postgresql/data/tmp. conf
Mv/opt/framework3/postgresql/data/tmp. conf/opt/framework3/postgresql/data/pg_apps.conf
# Restart IPVs server (only necessary during this process, on reboot it will start automatically)
Echo "Restarting IPVs server (only necessary during this process, on reboot it will start automatically ).."
Su postgres-c "/opt/framework3/postgresql/bin/postgres-D/opt/framework3/postgresql/data-p 7175 &"
# Wait for server to start
Sleep 5
# Now we can access via psql we can change user for database
Echo "Changing login s user login s password to 'others' s _ password '.."
Su postgres-c "psql-h 127.0.0.1-p 7175-c \" alter user login s with password 'login S _ password' \ ";">/dev/null 2> & 1
# Create a database for usage with msf
Echo "Creating database 'MSF _ db' for use with metasploit .."
Su postgres-c "psql-h 127.0.0.1-p 7175-c \" create database msf_db \ ";">/dev/null 2> & 1
# Change back to md5 auth
Echo "Changing back to md5 auth .."
Cat/opt/framework3/postgresql/data/pg_assist.conf | sed-e's/host all 127.0.0.1 \/32 trust/host all 127.0.0.1 \/32 md5/'>/opt /framework3/postgresql/data/tmp. conf
Mv/opt/framework3/postgresql/data/tmp. conf/opt/framework3/postgresql/data/pg_apps.conf
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service