mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix: cli admin reset-password fixes cmd args
Fixes the homepath and config command line args. This allows the command to be used even when the homepath is different from the default. Fixes #7730
This commit is contained in:
@@ -27,6 +27,24 @@ To show all admin commands:
|
||||
|
||||
### Reset admin password
|
||||
|
||||
You can reset the password for the admin user using the CLI.
|
||||
You can reset the password for the admin user using the CLI. The use case for this command is when you have lost the admin password.
|
||||
|
||||
`grafana-cli admin reset-admin-password ...`
|
||||
|
||||
If running the command returns this error:
|
||||
|
||||
> Could not find config defaults, make sure homepath command line parameter is set or working directory is homepath
|
||||
|
||||
then there are two flags that can be used to set homepath and the config file path.
|
||||
|
||||
`grafana-cli admin reset-admin-password --homepath "/usr/share/grafana" newpass`
|
||||
|
||||
If you have not lost the admin password then it is better to set in the Grafana UI. If you need to set the password in a script then the [Grafana API]({{< relref "http_api/user/#change-password" >}}) can be used. Here is an example with curl using basic auth:
|
||||
|
||||
```
|
||||
curl -X PUT -H "Content-Type: application/json" -d '{
|
||||
"oldPassword": "admin",
|
||||
"newPassword": "newpass",
|
||||
"confirmNew": "newpass"
|
||||
}' http://admin:admin@<your_grafana_host>:3000/api/user/password
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user