After trying all possible GVM command to get access to GUI after setup I found the only way how it worked for me.
I have to change password directly on DB. Here are steps. And I tried to run this wihtout stopping service and it worked anyway.
I;'m assuming that you know KALI terminal. You need 2 of them one for SQL and another for other things including HASH generation
Directly Resetting the Admin Password in PostgreSQL
Stop the GVM services:
shsudo systemctl stop gvmd sudo systemctl stop ospd-openvas
Access the PostgreSQL database: You need to access the
gvmd
database. The default user is usuallypostgres
. Use the following command to access the PostgreSQL command line:shsudo -u postgres psql gvmd
List the users in the gvmd database:
sqlSELECT name FROM users;
This will list all users. Identify the admin user.
Reset the password: Replace
admin_username
with the actual username of your admin account, andnewpassword
with your desired password. Note that the password needs to be hashed.Generate a new password hash using
gvmd
command:sudo gvmd --user=admin_username --new-password=newpassword
This should display a hash. If this does not work, you can generate the password hash using Python:
pythonpython3 -c "import crypt; print(crypt.crypt('newpassword', crypt.mksalt(crypt.METHOD_SHA512)))"
Update the user's password in the PostgreSQL database:
sqlUPDATE users SET password='hashed_password' WHERE name='admin_username';
Exit the PostgreSQL command line:
sql\q
Start the GVM services again:
shsudo systemctl start ospd-openvas sudo systemctl start gvmd
Verify the Password Reset: Try logging into the GVM web interface with the new password to ensure the reset was successful.