"admin" user disabled

Hello Everyone,

I am unable to login into Grafana as “admin” user. I see below error in the grafana.log file

t=2021-01-07T14:54:12+0300 lvl=warn msg="User is disabled" logger=http.server user=admin
t=2021-01-07T14:54:12+0300 lvl=eror msg="Invalid username or password" logger=context userId=0 orgId=0 uname= error="User is disabled" remote_addr=10.2.180.25
t=2021-01-07T14:54:12+0300 lvl=info msg="Request Completed" logger=context userId=0 orgId=0 uname= method=POST path=/login status=401 remote_addr=10.2.180.25 time_ms=1 size=42 referer=http://10.2.122.50:9205/login
t=2021-01-07T14:54:24+0300 lvl=info msg="New state change" logger=alerting.resultHandler ruleId=23 newState=pending prev state=ok
t=2021-01-07T14:54:26+0300 lvl=info msg="Successful Login" logger=http.server User=rcesh@sps.com

We haven’t disabled the user yet we are getting this issue. Could some please suggest how to fix this issue.

Settings in grafana.ini file:

[security]
# disable creation of admin user on first start of grafana
;disable_initial_admin_creation = false

# default admin user, created on startup
admin_user = admin

# default admin password, can be changed before first start of grafana,  or in profile settings
admin_password = admin

# used for signing
;secret_key = SW2YcwTIb9zpOOhoPsMm

# disable gravatar profile images
;disable_gravatar = false

# data source proxy whitelist (ip_or_domain:port separated by spaces)
;data_source_proxy_whitelist =

Thank you in advance.

-Ravi

please set
cookie_samesite = none
and cookie secure to true

Hello Melrose,

I updated grafana.ini file as you suggested. But I am still facing the same issue.

[security]
# disable creation of admin user on first start of grafana
;disable_initial_admin_creation = false

# default admin user, created on startup
admin_user = admin

# default admin password, can be changed before first start of grafana,  or in profile settings
admin_password = admin

# used for signing
;secret_key = SW2YcwTIb9zpOOhoPsMm

# disable gravatar profile images
;disable_gravatar = false

# data source proxy whitelist (ip_or_domain:port separated by spaces)
;data_source_proxy_whitelist =

# disable protection against brute force login attempts
;disable_brute_force_login_protection = false

# set to true if you host Grafana behind HTTPS. default is false.
cookie_secure = true

# set cookie SameSite attribute. defaults to `lax`. can be set to "lax", "strict", "none" and "disabled"
cookie_samesite = none

# set to true if you want to allow browsers to render Grafana in a <frame>, <iframe>, <embed> or <object>. default is false.
;allow_embedding = false

# Set to true if you want to enable http strict transport security (HSTS) response header.
# This is only sent when HTTPS is enabled in this configuration.
# HSTS tells browsers that the site should only be accessed using HTTPS.
# The default version will change to true in the next minor release, 6.3.
;strict_transport_security = false

# Sets how long a browser should cache HSTS. Only applied if strict_transport_security is enabled.
;strict_transport_security_max_age_seconds = 86400

# Set to true if to enable HSTS preloading option. Only applied if strict_transport_security is enabled.
;strict_transport_security_preload = false

Any other suggestions which I can try?

-Ravi

What happens if you try to Reset the admin password?

Also, are you sure you want to be posting your secret key on a public forum?

Hello Diana,

I did reset admin password through grafana-cli but with no success.

The public keys posted are not the real one :slight_smile:

-Ravi

Someone must have disabled your user. Have to use sqlite3 open open database and change user table, or mysql/postgres client if you use any of those as main db.

Hi Torkel,

Thank you for the suggestion. I have followed Sqlite documents to update ‘user’ table.

@Everyone,

For those who are facing similar issue or want to access Grafana default database (Sqlite), following are the steps:

To access database:

root@grafanahost> sqlite3 /var/lib/grafana/grafana.db

To list Tables:

sqlite> .tables

To view schema of a table:

sqlite> .schema <tablename>
Eg: sqlite> .schema user

To view table data:

sqlite> SELECT id, name, is_disabled FROM user;

To update a column:

sqlite> UPDATE <tablename> SET <columnName>=<value> WHERE <condition>;
Eg: sqlite> UPDATE user SET is_disabled=0 WHERE id=1;

To exit:

sqlite> .exit