0

I recently downloaded Metasploit and tried to run it by typing msfconsole but I get this:

** Welcome to Metasploit Framework Initial Setup **
    Please answer a few questions to get started.


Would you like to use and setup a new database (recommended)? (I put Yes)
/opt/metasploit-framework/embedded/framework/msfdb:176:in `initialize': Permission denied @ rb_sysopen - /home/jackattack/.msf4/database.yml (Errno::EACCES)
    from /opt/metasploit-framework/embedded/framework/msfdb:176:in `open'
    from /opt/metasploit-framework/embedded/framework/msfdb:176:in `init_db'
    from /opt/metasploit-framework/embedded/framework/msfdb:277:in `<main>'

 ** Metasploit Framework Initial Setup Complete **

touch: cannot touch '/home/jackattack/.msf4/initial_setup_complete': Permission denied
Rails Error: Unable to access log file. Please ensure that /home/jackattack/.msf4/logs/production.log exists and is writable (ie, make it writable for user and group: chmod 0664 /home/jackattack/.msf4/logs/production.log). The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.
/opt/metasploit-framework/embedded/framework/lib/rex/logging/sinks/flatfile.rb:21:in `initialize': Permission denied @ rb_sysopen - /home/jackattack/.msf4/logs/framework.log (Errno::EACCES)
    from /opt/metasploit-framework/embedded/framework/lib/rex/logging/sinks/flatfile.rb:21:in `new'
    from /opt/metasploit-framework/embedded/framework/lib/rex/logging/sinks/flatfile.rb:21:in `initialize'
    from /opt/metasploit-framework/embedded/framework/lib/msf/base/logging.rb:24:in `new'
    from /opt/metasploit-framework/embedded/framework/lib/msf/base/logging.rb:24:in `init'
    from /opt/metasploit-framework/embedded/framework/lib/msf/base/simple/framework.rb:111:in `simplify'
    from /opt/metasploit-framework/embedded/framework/lib/msf/base/simple/framework.rb:73:in `create'
    from /opt/metasploit-framework/embedded/framework/lib/msf/ui/console/driver.rb:74:in `initialize'
    from /opt/metasploit-framework/embedded/framework/lib/metasploit/framework/command/console.rb:62:in `new'
    from /opt/metasploit-framework/embedded/framework/lib/metasploit/framework/command/console.rb:62:in `driver'
    from /opt/metasploit-framework/embedded/framework/lib/metasploit/framework/command/console.rb:48:in `start'
    from /opt/metasploit-framework/embedded/framework/lib/metasploit/framework/command/base.rb:82:in `start'
    from /opt/metasploit-framework/bin/../embedded/framework/msfconsole:48:in `<main>'
You'reAGitForNotUsingGit
  • 14,669
  • 9
  • 48
  • 83
Jack Attack
  • 1
  • 1
  • 2

2 Answers2

0

Please check if you can start posgres. You may need to create the posgres user account and also check, some file permissions.

nyxee
  • 367
  • 3
  • 10
0

Permission denied @ rb_sysopen - /home/jackattack/.msf4/database.yml (Errno::EACCES)

This issue might be that your .msf4/database.yml file is owned by another user (probably root, did you run metasploit as root before?)

You can check the ownership with ls -l ~/.msf4.

If you want to change it, run chown -R $(whoami) ~/.msf4 (assume you have logged in as jackattack)

P.-H. Lin
  • 2,804
  • 1
  • 17
  • 20
  • I copy-pasted your commands and got this: jackattack@Squid:~$ chown -R $(whoami) ~/.msf4 jackattack@Squid:~$ ls -l ~/.msfs4. ls: cannot access '/home/jackattack/.msfs4.': No such file or directory jackattack@Squid:~$ – Jack Attack May 10 '17 at 02:42
  • OK then, that's a different thing. Try to create the directory first, run `msfconsole` and let it finish, type `quit` to leave, it should create the directory for you, ref: http://www.backtrack-linux.org/forums/showthread.php?t=45081 – P.-H. Lin May 10 '17 at 03:44
  • I type msfconsole and it says command not found – Jack Attack May 10 '17 at 23:07
  • If `msfconsole` returns command not found, you must changed something, as you said in your question it should print these error message. I also tried with metasploit-4.13.1-linux-x64-installer.run, it looks like there will be a database.yml file in the installation directory, for me it's `/opt/metasploit/apps/pro/ui/config/database.yml`. In your case probably somewhere in `/opt/metasploit-framework/`, this is the last thing I can help. – P.-H. Lin May 11 '17 at 03:38