gitlab-org--gitlab-foss/doc/security/reset_root_password.md

40 lines
755 B
Markdown
Raw Normal View History

2015-05-08 14:35:05 +00:00
# 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
2015-05-07 16:48:25 +00:00
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
irb(main):001:0> u = User.where(id: 1).first
2015-05-07 16:48:25 +00:00
```
or
2015-05-07 16:48:25 +00:00
```bash
user = User.find_by(email: 'admin@local.host')
```
Now you can change your password:
```bash
2015-05-07 16:48:25 +00:00
u.password = 'secret_pass'
u.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
2015-05-07 16:48:25 +00:00
u.save!
```
2015-05-07 16:48:25 +00:00
Exit the console and try to login with your new password.