sravani1
(sravani)
December 3, 2024, 8:15am
1
Must-share information (formatted with Markdown ):
which versions are you using (SonarQube Server / Community Build, Scanner, Plugin, and any relevant extension) – community build
how is SonarQube deployed: zip, Docker, Helm – docker
what are you trying to achieve – build a sonarqube server to test our code.
what have you tried so far to achieve this-- installed sonarqube the UI is up but not able to login with admin/admin credentials. Tried resetting the password it got updated but still not bale to login getting unauthorized error.
Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!
ganncamp
(G Ann Campbell)
December 4, 2024, 6:22pm
2
Hi,
Welcome to the community!
Can you share how you reset the password?
Ann
sravani1
(sravani)
December 5, 2024, 5:15am
3
update users set
crypted_password=‘100000$t2h8AtNs1AlCHuLobDjHQTn9XppwTIx88UjqUm4s8RsfTuXQHSd/fpFexAnewwPsO6jGFQUv/24DnO55hY6Xew==’,
salt=‘k9x9eN127/3e/hf38iNiKwVfaVk=’,
hash_method=‘PBKDF2’,
reset_password=‘true’,
user_local=‘true’,
active=‘true’
where login=‘admin’;
sravani1
(sravani)
December 5, 2024, 5:18am
4
I used different images like latest ,community build, lts-community but all are giving me same error even after trying to reset the password.
I installed sonarqube using docker-compose .I confirm that the UI is coming but admin/admin is not working.
I tried to search for admin user inside postgres DB i didnt find one. not sure if im looking it correctly.
Please help me with this installation, we are going to use this in production if POC is successful.
ganncamp
(G Ann Campbell)
December 5, 2024, 2:00pm
5
Hi,
Without a char-by-char comparison, this looks like the Postgres / SQL Server reset SQL . So let’s back up: are you sure the admin
account still exists in the DB?
Ann
sravani1
(sravani)
December 6, 2024, 5:11am
6
Hi Ann,
No, i verified with \du command on DB and I see only sonar user is there. So created admin user and ran the update command.
CREATE USER admin WITH PASSWORD ‘admin’ ;
First created admin user and tried login with admin password, it didn’t work. Than ran the update command , then also it didn’t work.
I tried this command as well, but it gave me error like randon-uuid already used
insert into user_roles(uuid, user_uuid, role)
values (‘random-uuid’, (select uuid from users where login=‘mylogin’), ‘admin’);
ganncamp
(G Ann Campbell)
December 6, 2024, 4:32pm
7
Hi,
We’re not looking for a login you can use to access the database directly. You should probably delete that user from your database.
sravani:
I tried this command as well, but it gave me error like randon-uuid already used
insert into user_roles(uuid, user_uuid, role)
values (‘random-uuid’, (select uuid from users where login=‘mylogin’), ‘admin’);
Can you provide the exact error you got?
Thx,
Ann
sravani1
(sravani)
December 8, 2024, 2:53pm
8
I didnt see any errornow but still not able to login. Same authentication failed message on UI.
ganncamp
(G Ann Campbell)
December 9, 2024, 2:08pm
9
Hi,
From your screenshot, it seems you ran an UPDATE
on a user that didn’t exist yet, since the UPDATE
came before the INSERT
.
Ann
sravani1
(sravani)
December 9, 2024, 2:21pm
10
Hi,
No, I ran the INSERT command first in the screenshot then i used UPDATE.
ganncamp
(G Ann Campbell)
December 9, 2024, 2:29pm
11
Hi,
Sorry, my mistake.
I’ve just taken a closer look at that screenshot… it seems that you copy/pasted/ran the insert without customizing it, though.
Ann
sravani1
(sravani)
December 9, 2024, 3:14pm
12
Sorry but I am not sure how to use this command to enable/activate admin user. Can you please help me with that.
ganncamp
(G Ann Campbell)
December 9, 2024, 3:40pm
13
Hi,
The docs will get you started.
Ann
sravani1
(sravani)
December 9, 2024, 6:03pm
14
Yeah i used the same document.
The command is
insert into user_roles(uuid, user_uuid, role)
values (‘random-uuid’, (select uuid from users where login=‘mylogin’), ‘admin’);
I used the same for admin creation/activation.
Can you please let me know what fields i need to update.
ganncamp
(G Ann Campbell)
December 9, 2024, 6:08pm
15
Hi,
sravani:
where login=‘mylogin’
Did you run it like this^ or sub-in your actual login?
Ann
sravani1
(sravani)
December 9, 2024, 6:46pm
16
i ran the same command, login=‘mylogin’, do i need to change that ?
Please let me know what i should change. Sorry I am not a DB person so I am not aware of these commands.
ganncamp
(G Ann Campbell)
December 9, 2024, 7:07pm
17
Hi,
From the docs I linked above (emphasis mine):
If by mistake, you have no users able to access SonarQube Server with the global ‘Administer system’ permission level, you must re-grant the ‘Administer system’ permission to an existing, active user with the following query (myLogin
in the query sample represents the login of the user who should become a system administrator ):
In other words, myLogin
is just a placeholder for the login of the user in your organization that you want to grant admin rights to.
HTH,
Ann
sravani1
(sravani)
December 10, 2024, 5:42pm
18
I have only one user “sonar” presently, should i replace mylogin with sonar?
insert into user_roles(uuid, user_uuid, role)
values (‘random-uuid’, (select uuid from users where login=‘sonar’), admin’);
Next shall i run this command as is or any chnages here ?
update users set
crypted_password=‘100000$t2h8AtNs1AlCHuLobDjHQTn9XppwTIx88UjqUm4s8RsfTuXQHSd/fpFexAnewwPsO6jGFQUv/24DnO55hY6Xew==’,
salt=‘k9x9eN127/3e/hf38iNiKwVfaVk=’,
hash_method=‘PBKDF2’,
reset_password=‘true’,
user_local=‘true’,
active=‘true’
where login=‘admin’;
ganncamp
(G Ann Campbell)
December 10, 2024, 6:11pm
19
Hi,
Assuming we’re talking about users in SonarQube Community Build not database users), then yes.
sravani:
Next shall i run this command as is or any chnages here ?
update users set
crypted_password=‘100000$t2h8AtNs1AlCHuLobDjHQTn9XppwTIx88UjqUm4s8RsfTuXQHSd/fpFexAnewwPsO6jGFQUv/24DnO55hY6Xew==’,
salt=‘k9x9eN127/3e/hf38iNiKwVfaVk=’,
hash_method=‘PBKDF2’,
reset_password=‘true’,
user_local=‘true’,
active=‘true’
where login=‘admin’;
If you have only one user in SonarQube then that where login='admin'
needs to say where login='sonar'
.
HTH,
Ann
sravani1
(sravani)
December 11, 2024, 12:33pm
20
Hi,
can you please let me know how to check SonarQube Community users, using which we can login to the UI.
I got bit confused here, are DB users different from sonarqube users ?
I want to know where we can check for sonarqube users who can login to UI and how to reset the admin password if admin/admin credentials are not working.