# How can I access gvmd database from psql? (.deb Community Edition)

**URL:** <https://forum.greenbone.net/t/how-can-i-access-gvmd-database-from-psql-deb-community-edition/10650>\
**Category:** Greenbone Community Edition\
**Created:** [November 9, 2021, 2:26pm UTC](https://forum.greenbone.net/t/how-can-i-access-gvmd-database-from-psql-deb-community-edition/10650 "2021-11-09T14:26:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![antonio.gananet](https://forum.greenbone.net/letter_avatar/antonio.gananet/32/6_449c533f586939b6e5f246632a46421f.png) [@antonio.gananet](https://forum.greenbone.net/u/antonio.gananet)\
**Post date:** [November 9, 2021, 2:26pm UTC](https://forum.greenbone.net/t/how-can-i-access-gvmd-database-from-psql-deb-community-edition/10650/1 "2021-11-09T14:26:38Z")

</div>

Hello everyone and thank you in advance for your help, I’m new here and this is my first post, I apologize if somehow I mis-posted this question, I could not find an answer in previous posts using the search functions.

I installed GVM Community Edition directly on a fresh Kali installation, with virtually no customizations:

### GVM versions

**gsad:** 21.4.3  
**gvmd:** 21.4.4  
**openvas-scanner:** 21.4.2.  
**gvm-libs:** 21.4.2

### Environment

**Operating system:** Kali 2021.3  
**Kernel:** Linux kali 5.14.0-kali2-amd64 #1 SMP Debian 5.14.9-2kali1 (2021-10-04) x86\_64 GNU/Linux  
**Installation method / source:** standard package manager.

The scanner runs fine, postgresql 14 is listening on port 5433/tcp, everything’s alright.

So, here’s my question:  
I had a python script that extracted more information from the old sqlite database (mostly from the “hosts”, “hosts\_identifiers” and “host\_details” tables) to further customize my LaTeX reporting, but now that GVM has transitioned to postgresql I cannot connect anymore to the database directly via a script to collect data from those tables since I don’t know the password…

As far as I understand, during the installation process an ad-hoc postgresql user has been created for gvmd with a (possibly?) random password and only local connections are allowed. I have basically no previous experience with postgres. Is there a default password to access the database via command line?

here’s what I tried:

- `psql -h localhost -p 5433 -U postgres --no-password` doesn’t work. I tried to launch that command as standard user, with sudo and as \_gvm and postgres users with no luck. I assume that postgres user doesn’t exist.

- `psql -h localhost -p 5433 -U gvm --no-password` doesn’t work either. I am pretty sure that user gvm exists, I can’t prove it though…

To create a new “superuser” - from what I can tell - I still need a valid postgres account with admin privileges.

Can any one of you point me to the right direction?

Thank you!

---

<div class="post-metadata">

**Author:** ![antonio.gananet](https://forum.greenbone.net/letter_avatar/antonio.gananet/32/6_449c533f586939b6e5f246632a46421f.png) [@antonio.gananet](https://forum.greenbone.net/u/antonio.gananet)\
**Post date:** [November 10, 2021, 9:02am UTC](https://forum.greenbone.net/t/how-can-i-access-gvmd-database-from-psql-deb-community-edition/10650/2 "2021-11-10T09:02:03Z")

</div>

I think I found a solution to my own problem: in fact, I was overthinking the whole thing.  
Somehow if I run as “\_gvm” user the commands “psql” and “pg\_dump” without specifying port, hostname and user/password everything works just fine:

- `sudo -u _gvm psql gvmd` just works, as well as:

- `sudo -u _gvm pg_dump --inserts gvmd -t table> table.sql`

Using python (as user “\_gvm”), it is possible to fetch data from gvmd using psycopg2 and no other info than the DB name:

```auto
conn = psycopg2.connect(dbname = "gvmd")

```

Okay, probably it was a dumb question, but I hope someone will find the answer useful, somehow!  
Thank you.

---

<div class="post-metadata">

**Author:** ![Oscar.Niebles](https://forum.greenbone.net/letter_avatar/oscar.niebles/32/6_449c533f586939b6e5f246632a46421f.png) [@Oscar.Niebles](https://forum.greenbone.net/u/Oscar.Niebles)\
**Post date:** [May 5, 2022, 9:37pm UTC](https://forum.greenbone.net/t/how-can-i-access-gvmd-database-from-psql-deb-community-edition/10650/3 "2022-05-05T21:37:03Z")

</div>

Hola Antonio  
Se puede conectar a través de pgadmin?  
Es que quiero personalizar un informe en Excel extrayendo esos datos.

---

<div class="post-metadata">

**Author:** ![antonio.gananet](https://forum.greenbone.net/letter_avatar/antonio.gananet/32/6_449c533f586939b6e5f246632a46421f.png) [@antonio.gananet](https://forum.greenbone.net/u/antonio.gananet)\
**Post date:** [May 6, 2022, 6:45am UTC](https://forum.greenbone.net/t/how-can-i-access-gvmd-database-from-psql-deb-community-edition/10650/4 "2022-05-06T06:45:16Z")

</div>

Hi Oscar, I did not try it, but I guess that you could run pgadmin launching it as user “\_gvm” from a shell…

---

<div class="post-metadata">

**Author:** ![system](https://forum.greenbone.net/uploads/default/original/2X/4/4660e797edfaea797a8c9965246072ea26732804.png) [@system](https://forum.greenbone.net/u/system)\
**Post date:** [April 7, 2025, 10:12am UTC](https://forum.greenbone.net/t/how-can-i-access-gvmd-database-from-psql-deb-community-edition/10650/5 "2025-04-07T10:12:51Z")

</div>

Closed on April 7, 2025, 10:12am UTC


