User Case: Metasploit Database Not Connected
This morning, when opening msfconsole, I encountered the following error: âpassword authentication failed for userâ msfâ. Confirmed, the PostgreSQL service has been started, and it is suspected that there may be a problem with Metasploit database not connected.
Fixing Metasploit Database Not Connected
As the relevant databases have not been used yet, use msfdb delete directly to delete them, and then initialize the relevant settings through the msfdb init command:
After completion, exit msfconsole, service postgresql restart, enter msfconsole again, normal:
Armitage can also be accessed normally, however, it may also be possible to modify and reset the password here through the following process:
- Open the postgreSQL service: services postgreSQL start
- Enter PostgreSQL, set default user password, create new user, set new user permissions, and create database:
Sudo u postgres psql # Enter the default user for postgreSQL
Alter user postgres with password âpasswordâ # Set default user login password
Create user âusernameâ wiht password âpasswordâ nocreatedb # Create a new user with a password
Create database âdatabase nameâ with owner=âusernameâ # Create a database and specify the user to whom the database belongs
- Enter metasploit and connect to the database:
msfconsole
Db_status # Viewing the Status of a Database
Db_connect username: password @ host address \ database name
Db_status # Check if the startup was successful