armitage icon indicating copy to clipboard operation
armitage copied to clipboard

MSF_DATABASE_CONFIG to $PATH database.yml file

Open AlphaMufasaOmega opened this issue 7 years ago • 7 comments

My database .yml file is not found by ./armitage how to fix?

AlphaMufasaOmega avatar Sep 07 '18 10:09 AlphaMufasaOmega

it has something to do with this

I can not find database.yml. I *really* need it.

To connect to the Metasploit Framework database, Armitage needs to know the location of the database.yml file. This is normally available in the MSF_DATABASE_CONFIG environment variable.

If you installed Metasploit by hand, make sure MSF_DATABASE_CONFIG is set. You may want to try sudo -E to launch Armitage. This form of sudo will have Armitage inherit the root user's environment--including the MSF_DATABASE_CONFIG variable.

Kali Linux users, if you're getting this error--try:

   service postgresql start
   service metasploit start
   service metasploit stop

AlphaMufasaOmega avatar Sep 07 '18 10:09 AlphaMufasaOmega

where is MSF_DATABASE_CONFIG? i want to put it into path so i can fix this issue....

AlphaMufasaOmega avatar Sep 25 '18 08:09 AlphaMufasaOmega

For the people that may have the same question, you can set MSF_DATABASE_CONFIG like this: export MSF_DATABASE_CONFIG=/PATH/TO/database.yml/

Then run the Armitage with sudo -E : sudo -E ./armitage ...

shelld0n avatar Dec 25 '18 15:12 shelld0n

that would work but i think its better to reinstall it from begging again it would keep bugs him with error

salemhijazi avatar Jan 11 '19 01:01 salemhijazi

Actually I faced the same issue in my cent os 7 vm box. I did find the sample database.yml file in "/opt/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/metasploit-credential-3.0.4/spec/dummy/config/database.yml" location and it contains the following lines.

#######################################################

development: &pgsql adapter: postgresql database: metasploit-credential_development1 username: msf password: pass123 host: localhost port: 5432 pool: 5 timeout: 5 min_messages: warning test: <<: *pgsql database: metasploit-credential_test1

#############################################################

Copy above file to your home directory and make the changes such as DB user, DB password and DB name according to your requirements.

Run the following command. export MSF_DATABASE_CONFIG= Example: export MSF_DATABASE_CONFIG=~/database.yml Add following line in your .bash_profile also export MSF_DATABASE_CONFIG=~/database.yml

Then run "msfd" command, it will ask you for new database setup, type yes and enter. It will create the database for you. In case if it is not prompting for new database setup, please remove ".msf4" (hidden folder) in your home directory and again run "msfd" command.

harish457 avatar Mar 07 '20 18:03 harish457

i cant find the solution again it error,after re-installing also

chinni8899 avatar Mar 27 '20 15:03 chinni8899

i've used root@kali:/opt/metasploit-framework/bin# msfdb reinit Creating configuration file in /usr/share/metasploit-framework/config/database.yml and next export MSF_DATABASE_CONFIG=/usr/share/metasploit-framework/config/database.yml

asciiblck avatar Nov 26 '20 02:11 asciiblck