junjie lee
junjie lee

Reputation: 11

Change admin password in WEB UI have error

  1. change admin password in WEB UI (harbor v2.1.0)

  2. login in error happen, have success and unauthorized

WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded

WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: Get https://harbor.miduchina.com/v2/: unauthorized: authentication required
  1. core.log error
Feb 27 10:26:40 172.20.0.1 core[1682]: 2023-02-27T02:26:40Z [ERROR] [/server/middleware/security/basic_auth.go:41][requestID="ac22b544-ec79-4b1a-82fc-b6e9275769ca"]: failed to authenticate admin: Failed to authenticate user, due to error 'Invalid credentials'
Feb 27 10:26:42 172.20.0.1 core[1682]: 2023-02-27T02:26:42Z [ERROR] [/server/middleware/security/basic_auth.go:41][requestID="2312bec3-b450-4553-903b-b2de4e94b0e5"]: failed to authenticate admin: Failed to authenticate user, due to error 'Invalid credentials'
Feb 27 10:26:55 172.20.0.1 core[1682]: 2023-02-27T02:26:55Z [ERROR] [/server/middleware/security/basic_auth.go:41][requestID="fffae489-8b41-458b-8ea8-ae3d412ac86f"]: failed to authenticate admin: Failed to authenticate user, due to error 'Invalid credentials'
Feb 27 10:27:08 172.20.0.1 core[1682]: 2023-02-27T02:27:08Z [ERROR] [/server/middleware/security/basic_auth.go:41][requestID="b7e0678b-59cd-4574-80eb-61880b12335e"]: failed to authenticate admin: Failed to authenticate user, due to error 'Invalid credentials'
Feb 27 10:27:20 172.20.0.1 core[1682]: 2023-02-27T02:27:20Z [ERROR] [/server/middleware/security/basic_auth.go:41][requestID="e951b2e1-ea41-4fdd-890a-d8371dca8ea3"]: failed to authenticate admin: Failed to authenticate user, due to error 'Invalid credentials'
Feb 27 10:27:25 172.20.0.1 core[1682]: 2023-02-27T02:27:25Z [ERROR] [/server/middleware/security/basic_auth.go:41][requestID="fb78e6b7-a228-4660-9d89-ba2f626f87dd"]: failed to authenticate admin: Failed to authenticate user, due to error 'Invalid credentials'
Feb 27 10:27:40 172.20.0.1 core[1682]: 2023-02-27T02:27:40Z [ERROR] [/server/middleware/security/basic_auth.go:41][requestID="ff5603c5-6d4f-4b32-b9d7-fb267fe70771"]: failed to authenticate admin: Failed to authenticate user, due to error 'Invalid credentials'

What should I do?

Upvotes: 1

Views: 2020

Answers (1)

Vad1mo
Vad1mo

Reputation: 5543

Resetting Harbor Admin passwords is only possible via SQL.

Here is the process on how to reset the password.

This code example applies for Docker/Swarm.

Make sure the harbor server is running.

docker exec -it harbor-db
psql -U postgres
\c registry
update harbor_user set salt='', password='' where user_id = 1; 

Restart Harbor

docker-compose down -v
docker-compose up -d

Then you can log in with the initial admin password

If Harbor is installed in Kubernetes, you could reset the password with the same approach, just replace the docker command with kubectl command and restart the harbor-core pod after updating the harbor_user table.

Upvotes: 2

Related Questions