Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset Admin pass #1815

Closed
BenJule opened this issue Apr 19, 2015 · 26 comments
Closed

Reset Admin pass #1815

BenJule opened this issue Apr 19, 2015 · 26 comments

Comments

@BenJule
Copy link

BenJule commented Apr 19, 2015

I was changing my pass! But now, the new Password isnt working! How can i reset it?

@torkelo
Copy link
Member

torkelo commented Apr 20, 2015

yea, this feature is not yet implemented :(

@torkelo
Copy link
Member

torkelo commented Apr 20, 2015

what database do you use for grafana? Sqlite ? I can walk you trough or give you a script that resets it

@BenJule
Copy link
Author

BenJule commented Apr 20, 2015

@torkelo yes im using sqlite!

@ntmggr
Copy link

ntmggr commented Jul 16, 2015

i am using mysql, any chance you can post the instructions here.

@steve--d
Copy link

steve--d commented Aug 4, 2015

Need admin password reset for postgres.

@torkelo
Copy link
Member

torkelo commented Aug 4, 2015

Update the password and salt columns in the user table:
update user set password = '59acf18b94d7eb0694c61e60ce44c110c7a683ac6a8f09580d626f90f4a242000746579358d77dd9e570e83fa24faa88a8a6', salt = 'F3FAxVm33R' where login = 'admin'

if its mysql you need to escape user, like user

@torkelo
Copy link
Member

torkelo commented Aug 4, 2015

The above will set password back go admin/admin

@steve--d
Copy link

steve--d commented Aug 4, 2015

Thanks.

user table needs to be in quotes for postgres ie: update "user" set ...

@Qtax
Copy link
Contributor

Qtax commented Jan 11, 2016

+1

With SQLite on Ubuntu I had to do this:

$ sudo sqlite3 /var/lib/grafana/grafana.db

sqlite> update user set password = '59acf18b94d7eb0694c61e60ce44c110c7a683ac6a8f09580d626f90f4a242000746579358d77dd9e570e83fa24faa88a8a6', salt = 'F3FAxVm33R' where login = 'admin';
sqlite> .exit

@vahidm
Copy link

vahidm commented Apr 4, 2016

I tried the given solution, and when I logged in with admin user after a little while (less than a minute) it kicked me out to login page. Now I can not login and when I set password again it does not have any effect.

UPDATE: just checked the database, user was deleted for some reason I don't know. I'm not sure how to create new admin user. Should I open another issue?

@LB5000
Copy link

LB5000 commented Jul 4, 2016

@torkelo apologies for opening up an old thread. Can you tell me what type of hash value grafana uses and how you would create a salt value? I'm new to password hashing in general and wish to automate the creation of grafana users via mysql within my Puppet setup.

Any info you can provide would be appreciated.

Cheers,
L.

@KarnG
Copy link

KarnG commented Oct 27, 2016

@Qtax .. this is great trick.

@aphawk
Copy link

aphawk commented Feb 16, 2017

  1. stop grafana
  2. setup admin user and password in grafana.ini
  3. delete /var/lib/grafana/grafana.db
  4. restart

I did reset password this way, but all previous dashboard data is lost.

@ghost
Copy link

ghost commented Apr 6, 2017

Which hashing algorithm do you use, how to generate some other password?
thanks.

@daniellee
Copy link
Contributor

daniellee commented Apr 7, 2017

@miodrag-zivkovic-shiftplanning We use PBKDF2 from this golang package. For login, we also have a guard for time based attacks.

What do you mean by

how to generate some other password?

@eoekun
Copy link

eoekun commented Jul 26, 2017

why grafana-cli admin reset-admin-password admin docments not working? It's told me
Admin password changed successfully ✔
thanks for Qtax

@daniellee
Copy link
Contributor

daniellee commented Jul 26, 2017

@eoekun So you changed the password but it still does not work (with username admin)?

EDIT: nevermind, I see you did it via the database instead.

@eoekun
Copy link

eoekun commented Jul 28, 2017

@daniellee Use the grafana-cli does not work so I execute the sql statement.

@bergquist
Copy link
Contributor

http://docs.grafana.org/administration/cli/#reset-admin-password

@eoekun what version are you running? grafana-cli-admin reset-admin-password works fine for me in 4.5.2

@bethrezen
Copy link

bethrezen commented Mar 11, 2018

Just for anyone may need this - my grafana docker installation suddenly reseted user table and I was able to login only with default admin:admin pair.
grafana-cli admin reset-admin-password admin was not working just because of empty user table.

@xdfil
Copy link

xdfil commented Aug 13, 2018

  1. edit /etc/grafana/grafana.ini
    set admin_user and admin_password in the [security] section
  2. stop the grafana service
  3. delete the admin user from the db:
    # sqlite3 /var/lib/grafana/grafana.db
    sqlite> delete from user where login = 'admin';
  4. start the grafana service
  5. login with the admin user/pass you put in /etc/grafana/grafana.ini

@spieglt
Copy link

spieglt commented Aug 22, 2018

My user table (in /usr/share/grafana/data/grafana.db) has the admin user, and I've verified that the admin user row updates when using the sudo grafana-cli admin reset-admin-password newPassword command (while in /usr/share/grafana). Yet this does not allow you to log in with the new password.

Not only do the official instructions on the support page (http://docs.grafana.org/administration/cli/) not work, the instructions telling you to manually modify the SQLite3 database at /var/lib/grafana/grafana.db don't tell you that the password will be admin afterwards.

Your documentation should make clear that the relevant database is /var/lib/grafana/grafana.db, not /usr/share/grafana/data/grafana.db, and more importantly, you should make it possible to use the grafana-cli admin reset-admin-password against the real database. It is unreasonable to expect people to manually modify a hashed password and its salt in the database.

@gvreddym
Copy link

Team, We are running grafana in kubernetes container. I forgot the admin password and try to reset the password with below command. but no luck.
grafana-cli admin reset-admin-password --homepath "/usr/share/grafana" newpass

Can you please suggest how to i reset the admin@localhost/admin password on grafana container

@bergquist bergquist reopened this Sep 3, 2018
@bergquist
Copy link
Contributor

This is broken due to the service graph refactoring.

The cli does not init the transaction manager and the bus itself.

@ghost
Copy link

ghost commented Nov 22, 2018

1. edit `/etc/grafana/grafana.ini`
   set `admin_user` and `admin_password` in the `[security]` section

2. stop the grafana service

3. delete the admin user from the db:
   `# sqlite3 /var/lib/grafana/grafana.db`
   `sqlite> delete from user where login = 'admin';`

4. start the grafana service

5. login with the admin user/pass you put in `/etc/grafana/grafana.ini`

Worked for me thanks using v5.3.4 in a lxd container!

@gusutabopb
Copy link

@xdfil's solution worked for me but only after deleting ALL users, not just admin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests