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
=> #<ActiveRecord::Relation [#<User id:1 @root>]> 

irb(main):004:0> user = User.where(id:1).first
=> #<User id:1 @root>

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.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

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

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.