change-passwords-native-users.asciidoc 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. [[change-passwords-native-users]]
  2. === Setting passwords for native and built-in users
  3. After you implement security, you might need or want to change passwords for
  4. different users. You can use the <<reset-password,`elasticsearch-reset-password`>>
  5. tool or the <<security-api-change-password,change passwords API>> to change
  6. passwords for native users and <<built-in-users,built-in users>>, such as the
  7. `elastic` or `kibana_system` users.
  8. For example, the following command changes the password for a user with the
  9. username `user1` to an auto-generated value, and prints the new password
  10. to the terminal:
  11. [source,shell]
  12. ----
  13. bin/elasticsearch-reset-password -u user1
  14. ----
  15. To explicitly set a password for a user, include the `-i` parameter with the
  16. intended password.
  17. [source,shell]
  18. ----
  19. bin/elasticsearch-reset-password -u user1 -i <password>
  20. ----
  21. If you're working in {kib} or don't have command-line access, you can use the
  22. change passwords API to change a user's password:
  23. ////
  24. [source,console]
  25. ----
  26. POST _security/user/user1?refresh=true
  27. {
  28. "password" : "l0ng-r4nd0m-p@ssw0rd",
  29. "roles": ["admin"]
  30. }
  31. ----
  32. ////
  33. [source,console]
  34. ----
  35. POST /_security/user/user1/_password
  36. {
  37. "password" : "new-test-password"
  38. }
  39. ----
  40. //TEST[continued]