2019-06-07 10:33:31 -04:00
|
|
|
---
|
|
|
|
type: howto
|
|
|
|
---
|
2019-07-16 03:02:20 -04:00
|
|
|
|
2015-05-08 10:35:05 -04:00
|
|
|
# How to reset your root password
|
2015-04-28 18:42:19 -04:00
|
|
|
|
2019-06-07 10:33:31 -04:00
|
|
|
To reset your root password, first log into your server with root privileges.
|
2015-04-28 18:42:19 -04:00
|
|
|
|
2019-06-07 10:33:31 -04:00
|
|
|
Start a Ruby on Rails console with this command:
|
2015-04-28 18:42:19 -04:00
|
|
|
|
|
|
|
```bash
|
2015-05-07 12:48:25 -04:00
|
|
|
gitlab-rails console production
|
2015-04-28 18:42:19 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
Wait until the console has loaded.
|
|
|
|
|
|
|
|
There are multiple ways to find your user. You can search for email or username.
|
|
|
|
|
|
|
|
```bash
|
2015-05-08 10:36:24 -04:00
|
|
|
user = User.where(id: 1).first
|
2015-05-07 12:48:25 -04:00
|
|
|
```
|
|
|
|
|
2015-04-28 18:42:19 -04:00
|
|
|
or
|
2015-05-07 12:48:25 -04:00
|
|
|
|
|
|
|
```bash
|
2015-04-28 18:42:19 -04:00
|
|
|
user = User.find_by(email: 'admin@local.host')
|
|
|
|
```
|
|
|
|
|
|
|
|
Now you can change your password:
|
|
|
|
|
|
|
|
```bash
|
2015-05-08 10:36:24 -04:00
|
|
|
user.password = 'secret_pass'
|
|
|
|
user.password_confirmation = 'secret_pass'
|
2015-04-28 18:42:19 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
It's important that you change both password and password_confirmation to make it work.
|
|
|
|
|
|
|
|
Don't forget to save the changes.
|
|
|
|
|
|
|
|
```bash
|
2015-05-08 10:36:24 -04:00
|
|
|
user.save!
|
2015-04-28 18:42:19 -04:00
|
|
|
```
|
|
|
|
|
2018-07-18 12:06:31 -04:00
|
|
|
Exit the console and try to login with your new password.
|
2019-06-07 10:33:31 -04:00
|
|
|
|
|
|
|
<!-- ## Troubleshooting
|
|
|
|
|
|
|
|
Include any troubleshooting steps that you can foresee. If you know beforehand what issues
|
|
|
|
one might have when setting this up, or when something is changed, or on upgrading, it's
|
|
|
|
important to describe those, too. Think of things that may go wrong and include them here.
|
|
|
|
This is important to minimize requests for support, and to avoid doc comments with
|
|
|
|
questions that you know someone might ask.
|
|
|
|
|
|
|
|
Each scenario can be a third-level heading, e.g. `### Getting error message X`.
|
|
|
|
If you have none to add when creating a doc, leave this section in place
|
|
|
|
but commented out to help encourage others to add to it in the future. -->
|