How to run metasploit (missing database.yml) and make postgresql,metasploit run at startup


    In this tutorial, I'm going to share on How to run metasploit (missing database.yml) and make Postgresql,Metasploit to run at startup. For official documentation on running Metasploit in Kali Linux, please visit here.


Steps

1) Run postgresql and metasploit service on the machine by typing

orca@omura:~$sudo service postgresql start

orca@omura:~$sudo service metasploit start

Starting postgresql and Metasploit service

2)Run Metasploit framework by going  to Applications>Kali Linux>Top 10 security tools>Metasploit framework

 
Run Metasploit Framework




3) Once Metasploit finished loading, check the database connection by typing
 
msf>db_status



No connected database.

4)If metasploit does not connect to postgresql database, check for "database.yml" file in .msf4 file in home directory


No database.yml file

4.1)Copy database.yml file from opt directory by typing


orca@omura:~$sudo cp /opt/metasploit/apps/pro/ui/config/database.yml /home/orca/.msf4  


Copy file from /opt

4.2) Change file permission by typing

orca@omura:~/.msf4$ sudo chmod 755 database.yml

Change file permission

5)Run Metasploit framework by going  to Applications>Kali Linux>Top 10 security tools>Metasploit framework and check database connection status

Check the database connection
(If it is not connected, you can try to create a new database and new user to make it work with metasploit . I will share in my future tutorial on how to do this)

6)Make postgresql and metasploit service to run at startup by typing

orca@omura:~/.msf4$ sudo update-rc.d postgresql enable

orca@omura:~/.msf4$ sudo update-rc.d metasploit enable



Updating Postgresql and Metasploit service to run at startup

 7)Reboot your machine and try to run Metasploit framework straight after you log on.

System reboot