> For the complete documentation index, see [llms.txt](https://docs.terrastories.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.terrastories.app/miscellaneous/troubleshooting/resetting-passwords-using-the-rails-console.md).

# Resetting passwords (using the Rails console)

{% hint style="warning" %}
This page requires some technical knowledge about server administration, and also requires you to have direct access to the server where your Terrastories server is hosted. \
\
If the content of this page feels unfamiliar to you, get someone acquainted with server administration to help you.
{% endhint %}

It may happen that a user is locked out of their community space because they lost their credentials; or, for your Terrastories server, you have lost the password to your super admin account.

Currently, there is no user interface to reset passwords, although we want to make it possible for super admin users to reset the password of a community admin user upon request.

It can be done using the [Rails console](https://guides.rubyonrails.org/command_line.html), however.

Depending on your hosting environment, the way you access the Rails console may differ:

* On a "Field Kit" or Kakawa Terrastories server, you will need to first get into the `terrastories-web` Docker container's shell, like this:

```
$ docker compose exec web /bin/bash
```

* For online hosting services like Heroku, you can either use a web console or access the server via ssh.

Once you are logged into the Docker container, you can access the rails console from the Terrastories directory:

```
bin/rails console
```

Now, you can update the password for the user (in case of the Terrastories super-user, the username is `terrastories-super`):

```
u = User.find_by(email: email)
u.update!(password: "newpassword", password_confirmation: "newpassword")
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.terrastories.app/miscellaneous/troubleshooting/resetting-passwords-using-the-rails-console.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
