I'm currently running Kali Linux and all of the sudden postgresql has stopped connecting to things.

my output for msfconsole is

Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? could not connect to server: Connection refused Is the server running on host "localhost" ( and accepting TCP/IP connections on port 5432?

I've looked everywhere I could have online for a solution but have not found anything.

my pg_hba.conf file is here

my metasploit database.yml file is here

I have reinstalled postgresql numerous times and stopped and started the service also. Please tell me if you need me to attach more files or need any more info. Thanks in advance.

  • And the first (basic, obviously) question: is the postgres server still running? Your screenshot kind of suggests MacOS, what's the relationship between the kali instance and the mac? – tink Apr 1 '16 at 2:30
  • There is no relationship between kali and mac I'm using a toshiba with no vmware. Kali Linux is my main operating system And yes posgres is running – Zach Apr 1 '16 at 15:02

If you need to setup postgresql and think you messed up with it, wipe it via apt purge and reinstall. Then first thing to do is to connect as postgres user. CD into /usr/lib/postgresql/9.5/bin and start ./initdb -D /var/lib/postgresql/9.5/main/.

Still as postgres user, create a new db and user createdb msf, createuser msf, then start the server ./pg_ctl -D /var/lib/postgresql/9.5/main/ start.

Once this is done you can log under your own account and start metasploit framework, you should be able to connect as msf@

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.