본문 바로가기

시스템/Gitlab

[Gitlab docker] 초기 설치 후 root password 강제 변경

반응형

Gitlab root password를 변경하는 방법

 

  • 현재 Gitlab을 Docker Container 확인 및 초기 패스워드 확인
# docker 확인
> docker ps
CONTAINER ID   IMAGE                          COMMAND             CREATED          STATUS                   PORTS                                                            NAMES
8bc6d61e53ab   gitlab/gitlab-ee:14.7.2-ee.0   "/assets/wrapper"   15 minutes ago   Up 7 minutes (healthy)   0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:8022->22/tcp   gitlab

# 초기 패스워드 확인
> docker exec -it 8bc6d61e53ab grep 'Password:' /etc/gitlab/initial_root_password
Password: B5fSlUphSG1bJ4wEZZjqqQkmgxxbb+AlBc2RN+DrssY=

 

  • Gitlab Container 접속
# gitlab에 접근
> docker exec -it 8bc6d61e53ab /bin/bash

 

  • gitlab console을 실행
root@111333:/# gitlab-rails console -e production
--------------------------------------------------------------------------------
 GitLab:       13.5.3 (eaa194f15e6) FOSS
 GitLab Shell: 13.11.0
 PostgreSQL:   11.9
--------------------------------------------------------------------------------
Loading production environment (Rails 6.0.3.3)
irb(main):001:0>

 

  • root password 변경(id 1)
irb(main):003:0> user = User.where(id:1).first
=> #<User id:1 @root>
irb(main):004:0> user.password = 'adminadmin'
=> "adminadmin"
irb(main):005:0> user.password_confirmation = 'adminadmin'
=> "adminadmin"

 

  • 저장
irb(main):006:0> user.save!
Enqueued ActionMailer::MailDeliveryJob (Job ID: 9feff9d9-f453-4d6a-a497-a049c11d09e6) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#<GlobalID:0x00007f07477e51d0 @uri=#<URI::GID gid://gitlab/User/1>>]}
=> true

 

반응형

'시스템 > Gitlab' 카테고리의 다른 글

[Gitlab] remote: GitLab: Push operation timed out  (0) 2023.07.04