> For the complete documentation index, see [llms.txt](https://kb.rport.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kb.rport.io/need-help/troubleshoot-common-problems/recover-lost-passwords.md).

# Recover lost passwords

### RPort 0.9.12 and newer

RPort 0.9.12 has introduced a command line interface to set password of existing users.

Log in via SSH to your RPort server. Switch to the rport user account by executing \
`su - rport -s /bin/bash`.  🙅‍♂️ Do not perform the next steps from the root user account!

To change a password of a user, execute:

```
rportd user change -u <USERNAME> -p -c /etc/rport/rportd.conf
```

You will be asked interactively for the new password.

### RPort 0.9.5 and older

#### Step 1 – log in via SSH

To reset a lost password, login to your RPort server via SSH and become the root user. If you have installed the RPort server with the [cloud-installer](/install-the-rport-server/install-rport-on-any-virgin-cloud-vm.md) script, a sqlite3 database is used for authentication.&#x20;

If you are not sure what is the underlying storage for users and passwords, open the configuration file with a page, for example, `less /etc/rport/rportd.conf` and scroll down to the `[api]` section.

![Check where users and passwords are stored](/files/-MfqX39P5_Vw9zgLLDFu)

#### Step 2 – create a new hash

If you are using a static pair of username and password – option number 1 in the above screenshot – just change it and restart the rport server.

If users and passwords are stored in a json-file or in a database, all passwords are stored as brypt hashes. Create a new hash and store it in the variable `PASSWD_HASH`.

```
NEW_PASSWD="<TYPE_IN_HERE>"
PASSWD_HASH=$(htpasswd -nbB password $NEW_PASSWD|cut -d: -f2)
```

![Create a password hash](/files/-MfqYjmTK42ALuaMrtKD)

#### Step 3 – update the password

**On a json file**

If you are using a json file, open it with a text editor, go to the line of the user you want the password to be updates, and replace the password hash by the one previously created.

Restart the rport server using `systemctl restart rport` and you are done.&#x20;

**On a sqlite database**

Check who is in there.

```
DB_FILE=/var/lib/rport/user-auth.db
cat <<EOF|sqlite3 $DB_FILE
.headers ON
SELECT * FROM users;
EOF
```

Update the password hash of a user

```
DB_FILE=/var/lib/rport/user-auth.db
cat <<EOF|sqlite3 $DB_FILE
UPDATE users SET password="$PASSWD_HASH" WHERE username="admin";
EOF
```

This will update the password of the user `admin` with the previously created hash. \
💪 **You are done.** You don't need to restart the rport server.


---

# 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, and the optional `goal` query parameter:

```
GET https://kb.rport.io/need-help/troubleshoot-common-problems/recover-lost-passwords.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
