본문 바로가기

인프라/MW

[GitLab/Linux or Unix] password reset (Root/Admin)

GitLab 어드민 계정 패스워드 분실 시, 계정을 찾는 시간을 단축 할수 있기에 해당 내용을 기재한다.

설정방법은 서버 콘솔에 접속하여, GitLab 데몬콘솔을 이용하여 설정하는 방법이다.

 

ㅇ GitLab이 설치되어 있을 시, 명령어 위치 확인가능(Linux or Unix)

whereis gitlab-rails | awk '{print $2}'

 

ㅇ GitLab 명령어가 위치한 디렉터리에 이동하여 콘솔 툴을 확인하여  접속

gitlab-rails console -e production

 

ㅇ GitLab 콘솔 접속하여, 패스워드 변경 대상정보 검색

user = User.where(id: 1).first

or

user = User.find_by(email: 'admin@example.com')

 

ㅇ 패스워드 변경

user.password = '${변경할 패스워드}'
user.password_confirmation = '${변경할 패스워드}'

 

ㅇ 패스워드 변경 후, 변경된 정보 저장

user.save!

 

#- References
[gitlab_docs] reset_root_password