Operations 3 min read

Resetting the GitLab Root Password via Console and Password Recovery

This guide explains how to retrieve and change the temporary GitLab root password generated during a Terraform deployment, outlines two recovery methods—including using the password‑reset feature and directly updating the password through the GitLab Rails console with example code.

DevOps Cloud Academy
DevOps Cloud Academy
DevOps Cloud Academy
Resetting the GitLab Root Password via Console and Password Recovery

When a GitLab instance is deployed with Terraform, the initial root password stored in /etc/gitlab/initial_root_password is time‑limited, requiring you to obtain it promptly and change it; this issue does not occur for GitLab instances that have been upgraded from a previous version.

Method 1: Password recovery operation – Use GitLab’s built‑in password‑reset functionality to request a new password for the root account.

Method 2: Update password via GitLab Rails console – Access the production console and modify the root user’s password directly. Example commands:

# gitlab-rails console -e production

irb(main):003:0> User.all
=> #
]> 

irb(main):004:0> user = User.where(id:1).first
=> #
irb(main):008:0> user.password = '12345678'
=> "12345678"

irb(main):009:0> user.password_confirmation = '12345678'
=> "12345678"

irb(main):010:0> user.save!
=> true

After saving, the root password is updated to the new value you specified.

The article also includes promotional information about the DevOps Cloud Academy, which offers resources such as open‑source practice documents, technical exchange circles, and FAQ libraries for DevOps practitioners.

operationsDevOpsGitLabTerraformPassword Reset
DevOps Cloud Academy
Written by

DevOps Cloud Academy

Exploring industry DevOps practices and technical expertise.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.