본문 바로가기

리눅스

[리눅스] Jenkins 관리자(admin) 비밀번호 재설정

728x90

Jenkins 관리자(admin) 비밀번호 재설정

docker-compose.yml 파일

$ vim docker-compose.yml
version: '3.7'
services:

  jenkins:
    #image: jenkins/jenkins:lts
    #image: jenkins/jenkins:lts-jdk11
    image: anti1346/jenkins-dood:latest
    container_name: jenkins
    restart: always
    privileged: true
    #user: root
    environment:
      TZ: "Asia/Seoul"
    volumes:
      #- /usr/bin/docker:/usr/bin/docker
      - /var/run/docker.sock:/var/run/docker.sock
      - ./jenkins_home:/var/jenkins_home
    ports:
      - 8080:8080
      - 50000:50000

jenkins 컨테이너 확인

$ docker-compose ps
 Name                Command               State                                           Ports
-----------------------------------------------------------------------------------------------------------------------------------------
jenkins   /sbin/tini -- /usr/local/b ...   Up      0.0.0.0:50000->50000/tcp,:::50000->50000/tcp, 0.0.0.0:8080->8080/tcp,:::8080->8080/tc

jenkins 구성 파일의 백업 복사본 만들기

$ cp jenkins_home/config.xml jenkins_home/config.xml.bk

config.xml 편집

<useSecurity>true</useSecurity> -> <useSecurity>false</useSecurity>

$ vim jenkins_home/config.xml
  1 <?xml version='1.1' encoding='UTF-8'?>
  2 <hudson>
  3   <disabledAdministrativeMonitors>
  4     <string>jenkins.diagnostics.ControllerExecutorsNoAgents</string>
  5     <string>hudson.diagnosis.ReverseProxySetupMonitor</string>
  6   </disabledAdministrativeMonitors>
  7   <version>2.319.1</version>
  8   <numExecutors>2</numExecutors>
  9   <mode>NORMAL</mode>
 10   <useSecurity>false</useSecurity>
 11   <authorizationStrategy class="hudson.security.AuthorizationStrategy$Unsecured"/>
 12   <securityRealm class="hudson.security.SecurityRealm$None"/>
 13   <disableRememberMe>false</disableRememberMe>
 ...

jenkins 컨테이너 재기동

$ docker-compose down
$ docker-compose up -d

WEB UI 새로 고침

- 익명 사용자(anonymous user)로 Jenkins에 액세스(패스워드 없이 로그인)

Jenkins 관리자(admin) 비밀번호 재설정

관리자 계정 삭제

관리자 계정(admin) 만들기 및 새 관리 사용자로 로그인

config.xml 원복

$ cp jenkins_home/config.xml.bk jenkins_home/config.xml

jenkins 컨테이너 재기동

$ docker-compose restart
Restarting jenkins ... done

WEB UI 로그인

728x90