Jump to content

Recommended Posts

Posted

hi

I got a problem with metasploit

[-] Failed to connect to the database: PG::InsufficientPrivilege: ERROR: permission denied for relation workspaces
: SELECT "workspaces".* FROM "workspaces" WHERE "workspaces"."name" = 'default' ORDER BY "workspaces"."id" ASC LIMIT 1

how can i fix this please

Posted

How did you get to this? It would seem that your Postgres install is running, but the account you use to access it doesn't have sufficient rights to the Metasploit schema.

Your current state is this:

- The database is running.

- The account you use to access it is valid and the password you use for it is correct.

- The schema you're accessing is available to you/the current account.

- The "workspaces" table exists within the schema you're accessing

You could log in as the postgres user and try "grant select on workspaces to <loginname>" but I suspect this will only fix it for the one table and more tables will be needing this treatment. What, if anything, did you do to get to this point?

  • 1 month later...
Posted

I was running into the same issue and it turned out the database was already owned by the msf user. Changing the msf database ownership to user msfgit (like in the metasploitminute video) resulted in the permission error for relation workspaces that you are getting. I wanted to avoid trying to change ownership for everything and missing something but I was able to fix it two different ways: use the msf user with the existing msf database or create a new database for user msfgit.

Option 1 - Use Existing Database With User msf

1. Change the msf database ownership back to the msf user if needed and optionally set the msf user password if you don't know it:

su - postgres
psql
ALTER DATABASE msf OWNER TO msf;
ALTER USER msf WITH PASSWORD 'msf';
\q
exit

Update database.yml:

production
   adapter: postgresql
   database: msf
   username: msf
   password: msf
   host: 127.0.0.1
   port: 5432
   pool: 75
   timeout: 5

Option 2 - Use New Database With New User

Create msfgit database for user msfgit:

su - postgres
createuser msfgit -P -S -R -D
createdb -O msfgit msfgit

Update database.yml:

production
   adapter: postgresql
   database: msfgit
   username: msfgit
   password: msf
   host: 127.0.0.1
   port: 5432
   pool: 75
   timeout: 5

Maybe you are having a different issue but hopefully that helps.

Posted (edited)

If your using Kali 2.0



apt-get update && apt-get upgrade

Then try:



service postgresql start
service metasploit start
service metasploit stop

If the above are ok, then do:



msfd init

msfd will initialize the database for the first time if you haven't ever used metasploit yet. Then try msfconsole and you should be fine. Personally I'd go with Kali since metasploit is pre-installed. community edition was not shipped by default with 2.0 though, but you can register and install it afterwards on your own.

https://community.rapid7.com/community/metasploit/blog/2015/08/12/metasploit-on-kali-linux-20

https://www.offensive-security.com/metasploit-unleashed/msf-community-edition/

Edited by digip

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...