Last active
June 10, 2024 09:15
-
-
Save aKamrani/de720b5e08b98757ee96807991b960ba to your computer and use it in GitHub Desktop.
Reset Harbor Password
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://knowledge.broadcom.com/external/article/329106/how-to-reset-and-retrieve-forgotten-harb.html | |
| To retrieve the admin password configured initially during the deployment of Harbor tile vm: | |
| Log in to Harbor instance by running: | |
| bosh -d harbor-container-registry-xxxxxxxxxxxxxxxxxxxx ssh | |
| Provide root privileges by running sudo -i. | |
| Set the docker environment alias by running the below command: | |
| alias docker='/var/vcap/packages/docker/bin/docker -H unix:///var/vcap/sys/run/docker/dockerd.sock' | |
| Run docker ps and make a note of the harbor-adminserver or harbor-core container id. | |
| Harbor version <=1.7: docker exec to the harbor-adminserver container | |
| Harbor version >=1.8: docker exec to the harbor-core container | |
| For example: | |
| docker exec -it harbor-core bash | |
| Run env and make a note of HARBOR_ADMIN_PASSWORD. | |
| Note: This is the admin password configured during initial harbor tile vm deployment. This entry does not get updated if the password is changed later from Harbor GUI. | |
| To reset the admin password that was updated from Harbor UI and forgotten: | |
| If the administrator have changed the harbor admin password from GUI and forgot it later, follow the below steps to reset back to the initial configured one. | |
| Note: The below steps are going to modify the harbor database and need to be performed with caution. If you need help with these steps, please file a Support Request with VMware support. | |
| Run docker ps and confirm that all the containers are running. | |
| Login to the harbor-db container by running the following command: | |
| docker exec -it harbor-db bash | |
| Connect to the database by running the following commands: | |
| psql -U postgres -d registry | |
| Run the below command to list the harbor users: | |
| select * from harbor_user; | |
| Note: Make a note of the admin user_id for the next step | |
| Run the below command to reset the admin password | |
| update harbor_user set salt='', password='' where user_id = 1; | |
| Note: This will set the admin password back to what it was initially configuring during harbor tile vm deployment. | |
| Exit from the db and container by running \q. | |
| Restart Harbor service by running: | |
| docker-compose restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment