summaryrefslogtreecommitdiff
path: root/doc/security/reset_root_password.md
blob: 6a882ed6fe5edc7a5a3d5867748719ca5430027f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# How to reset your root password

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

Start the console with this command:

```bash
gitlab-rails console production
```

Wait until the console has loaded.

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

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

or

```bash
user = User.find_by(email: 'admin@local.host')
```

Now you can change your password:

```bash
user.password = 'secret_pass'
user.password_confirmation = 'secret_pass'
```

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

Don't forget to save the changes.

```bash
user.save!
```

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