# Kan niet inloggen op een nieuwe installatie na het herstellen van een back-up

**URL:** https://meta.discourse.org/t/cant-login-to-a-new-installation-after-restoring-backup/374106
**Category:** Self-hosting
**Created:** [14 juli 2025 om 08:45 UTC](https://meta.discourse.org/t/cant-login-to-a-new-installation-after-restoring-backup/374106 "2025-07-14T08:45:44Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![alltiagocom](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alltiagocom/32/492709_2.png) [@alltiagocom](https://meta.discourse.org/u/alltiagocom)
#### Post date: [14 juli 2025 om 09:08 UTC](https://meta.discourse.org/t/cant-login-to-a-new-installation-after-restoring-backup/374106/2 "2025-07-14T09:08:04Z")

</div>

UPDATE: I was able to do it by following ChatGPT’s instructions:

### ✅ **Step 1: SSH into your server**

```bash
ssh your-user@your-server

```

* * *

### ✅ **Step 2: Enter the Discourse app container**

```bash
cd /var/discourse
./launcher enter app

```

* * *

### ✅ **Step 3: Create or reset the admin user’s password**

This step ensures you can log in with a known password.

```bash
rake admin:create

```

- When prompted, enter the **email address** of the admin from the backup (e.g. `admin@forum.example.com`).
- Enter a **new password**.
- Type `Y` when asked to grant admin privileges (even if the user already is an admin — it won’t hurt).

* * *

### ✅ **Step 4: Open the Rails console**

```bash
rails c

```

* * *

### ✅ **Step 5: Find the user by email**

Replace the email with the one you’re resetting:

```ruby
user = User.find_by_email("admin@forum.example.com")

```

You should see some output showing the user object.

* * *

### ✅ **Step 6: Disable 2FA for that user**

```ruby
user.user_second_factors.destroy_all

```

This deletes all 2FA keys associated with that user — without affecting anyone else.

* * *

### ✅ **Step 7: Exit the console and container**

```ruby
exit

```

* * *

### ✅ **Step 8: Log in via the web**

Go to your Discourse site in the browser and log in with:

- Email: `admin@forum.example.com`
- Password: the one you set in Step 3
- 2FA: **will no longer be required**

---

_[View the full topic](https://meta.discourse.org/t/cant-login-to-a-new-installation-after-restoring-backup/374106)._
