Skip to content

maxuru ~ % cat grafana/change-the-admin-password

Change the Grafana admin password

Severity: criticalApplies to: Grafana 11.x / 12.x / 13.x
The fix/etc/grafana/grafana.ini
[security]
admin_user = grafana_admin
admin_password = $__env{GF_SECURITY_ADMIN_PASSWORD}
Terminal window
sudo grafana-cli admin reset-admin-password "$(openssl rand -base64 24)"

Straight from Grafana’s defaults.ini:

admin_user = admin
admin_password = admin

The admin account is a Grafana Server Admin — the highest privilege level there is. It manages every organisation, every user, and every data source, which means it also holds the ability to read from and write to the systems those data sources point at.

Grafana prompts for a change at first login. That prompt is the reason this is widely assumed to be handled, and the reason it frequently is not: it can be dismissed, and it only applies to interactive first logins. An instance provisioned by configuration management, started from a container image, or brought up as part of a stack nobody logged into individually keeps admin/admin indefinitely.

admin_user = admin is as predictable as the password, and a known username halves the work for anyone attempting credentials. Renaming it does not stop a determined attacker — it does remove you from the bucket that automated credential stuffing is aimed at.

Brute-force protection is on by default (disable_brute_force_login_protection = false, five attempts), so a slow guessing attack is already constrained. That is a reason to relax about throttling, not about the default password — protection against guessing does not help when the credential does not need to be guessed.

grafana.ini is readable by the grafana user and lands in configuration management, backups and container images. Grafana supports environment interpolation so the value need not be in the file:

admin_password = $__env{GF_SECURITY_ADMIN_PASSWORD}

In containers the environment variable alone is enough — GF_SECURITY_ADMIN_PASSWORD overrides the file with no grafana.ini change at all. Make sure it comes from a secret store rather than a committed compose file, since docker inspect prints the environment of a running container to anyone in the docker group — which is root on the host.

The shared admin login is a break-glass account. Day-to-day access should be individual accounts, ideally from your identity provider (OAuth, SAML or LDAP), so that access is revoked when someone leaves and actions are attributable.

Grafana can be told not to create the built-in admin at all when an external provider is in place:

[security]
disable_initial_admin_creation = true

Only do this once external authentication is confirmed working. Setting it on a fresh instance with no other login path produces a Grafana nobody can get into.