BigW Consortium Gitlab

reset_root_password.md 750 Bytes
Newer Older
1
# How to reset your root password
2 3 4 5 6 7

Log into your server with root privileges. Then start a Ruby on Rails console.

Start the console with this command:

```bash
8
gitlab-rails console production
9 10 11 12 13 14 15
```

Wait until the console has loaded.

There are multiple ways to find your user. You can search for email or username.

```bash
16
user = User.where(id: 1).first
17 18
```

19
or
20 21

```bash
22 23 24 25 26 27
user = User.find_by(email: 'admin@local.host')
```

Now you can change your password:

```bash
28 29
user.password = 'secret_pass'
user.password_confirmation = 'secret_pass'
30 31 32 33 34 35 36
```

It's important that you change both password and password_confirmation to make it work.

Don't forget to save the changes.

```bash
37
user.save!
38 39
```

40
Exit the console and try to login with your new password.