How to create a new Postgresql database and new user to work with Metasploit Framework
In this tutorial, I'm going to share on how to create a new Postgresql database and new user to work with Metasploit Framework .This tutorial might be useful to those who have problems connecting to pre install Metasploit Framework either when you are running on Backtrack or Kali Linux.
In this tutorial,I will create a new database name "msf" and create a user name "msf" with password "metasploit". You will need to use this information when configure "database.yml" file . If you plan to use different database and user name please remember the details
Tutorial rundown
1) Run Postgresql service
2) Create new Postgresql user and database
3) Edit "database.yml" file
4) Run Metasploit service
5)Run the metasploit framework and check the connected database.
Steps
1) Run Postgresql service by typing
orca@omura:~$sudo service postgresql start
2) Create new Postgresql user and database
2.1) Create new user in Postgresql by login to postgres in root
orca@omura:~$sudo -su postgres
postgres@omura:/home/orca$ createuser msf -P -S -R -D
Enter password for new role :
Enter it again:
2.2) Create new database in Postgresql
postgres@omura:/home/orca$ createdb -o msf msf
postgres@omura:/home/orca$ exit
3) Edit "database.yml" file
3.1) Copy "database.yml" file from /opt/metasploit/apps/pro/ui/config/database.yml to home/.msf4 folder
orca@omura:~$sudo cp /opt/metasploit/apps/pro/ui/config/database.yml /home/orca/.msf4
NOTE :If you already have database.yml file in /home/.msf4 folder , you can skip this step.
3.2)Change the file permission and edit database.yml file details
orca@omura:~/.msf4$sudo chmod 755 database.yml
3.3)Edit "database.yml" file with the information that you use to create user and database.
production:
adapter :"postgresql"
database: "msf"
username: "msf"
password:"metasploit"
port:5432
host: "localhost"
pool:256
timeout:5
4) Run Metasploit service
orca@omura:~$sudo service metasploit start
5)Run the metasploit framework and check the connected database
5.1) Click "Applications>Kali Linux >Top 10 tools> Metasploit Framework "
5.2)Check the connected database
msf> db_status
Read Previous : How to run metasploit (missing database.yml) and make postgresql,metasploit run at startup