debian-mirror-gitlab/doc/security/reset_root_password.md

41 lines
751 B
Markdown
Raw Normal View History

2015-09-11 14:41:01 +05:30
# 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!
```
2018-11-20 20:47:30 +05:30
Exit the console and try to login with your new password.