본문 바로가기

리눅스

[리눅스] gitlab root 계정 비밀번호 초기화

728x90

gitlab root 계정 초기 비밀번호

gitlab 컨테이너 로그 확인

docker-compose logs -f

$ docker-compose logs -f
...
gitlab  |
gitlab  |                 == Seed from /opt/gitlab/embedded/service/gitlab-rails/db/fixtures/production/002_admin.rb
gitlab  |                 Administrator account created:
gitlab  |
gitlab  |                 login:    root
gitlab  |                 password: ******
gitlab  |
...
gitlab  | Running handlers:
gitlab  |
gitlab  | Notes:
gitlab  | Default admin account has been configured with following details:
gitlab  | Username: root
gitlab  | Password: You didn't opt-in to print initial root password to STDOUT.
gitlab  | Password stored to /etc/gitlab/initial_root_password. This file will be cleaned up in first reconfigure run after 24 hours.
gitlab  |
gitlab  | NOTE: Because these credentials might be present in your log files in plain text, it is highly recommended to reset the password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.
gitlab  |
gitlab  | Running handlers complete
gitlab  | Chef Infra Client failed. 441 resources updated in 06 minutes 00 seconds
gitlab  |
gitlab  | Notes:
gitlab  | Default admin account has been configured with following details:
gitlab  | Username: root
gitlab  | Password: You didn't opt-in to print initial root password to STDOUT.
gitlab  | Password stored to /etc/gitlab/initial_root_password. This file will be cleaned up in first reconfigure run after 24 hours.
gitlab  |
gitlab  | NOTE: Because these credentials might be present in your log files in plain text, it is highly recommended to reset the password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.

초기 비밀번호 확인(initial_root_password)

docker-compose exec glab bash
cat /etc/gitlab/initial_root_password
$ docker-compose exec glab bash

# cat /etc/gitlab/initial_root_password
# WARNING: This value is valid only in the following conditions
#          1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run).
#          2. Password hasn't been changed manually, either via UI or via command line.
#
#          If the password shown here doesn't work, you must reset the admin password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.

Password: FDA2toARpjTQAx7Imk3jDE5E6a34FofMO/tku9K3K7M=

# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.

gitlab root 계정 비밀번호 초기화

gitlab 컨테이너 진입

docker exec -it gitlab bash
gitlab-rails console -e production
# gitlab-rails console -e production

--------------------------------------------------------------------------------
 Ruby:         ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux]
 GitLab:       14.4.2 (1ce86e92f81) FOSS
 GitLab Shell: 13.21.1
 PostgreSQL:   12.7
--------------------------------------------------------------------------------
Loading production environment (Rails 6.1.4.1)
irb(main):001:0>
user = User.where(id: 1).first
irb(main):004:0> user = User.where(id: 1).first
=> #<User id:1 @root>
user.password='DefaultPassword'
user.password_confirmation='DefaultPassword'
irb(main):005:0> user.password='DefaultPassword'
=> "DefaultPassword"
irb(main):006:0> user.password_confirmation='DefaultPassword'
=> "DefaultPassword"
user.save
irb(main):007:0> user.save
Enqueued ActionMailer::MailDeliveryJob (Job ID: 92e56931-e226-4c20-8459-78d23329499f) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#<GlobalID:0x00007f4dfbc98c90 @uri=#<URI::GID gid://gitlab/User/1>>]}
=> true

로그인 성공 ^0^!!

728x90