背景
突然某一天harbor密码忘记了,登录不进去了
又或者某一个时刻,明明对的密码就是提示错误
此刻就需要强制重置密码来回复harbor的管理权职责在harbor版本为
v2.9.0
版本上面操作
操作步骤
核心脚本
update harbor_user set salt='',password='' where user_id = 1;
再次登录会要求初始化新密码
docker exec -it harbor-db /bin/bash
psql -h postgresql -d postgres -U postgres
root123
postgres=# \c registry;
registry=# \d harbor_user;
registry=# show password_encryption;
password_encryption
---------------------
scram-sha-256
(1 row)
registry=# select user_id,username,password,salt,deleted,password_version from harbor_user order by user_id;
user_id | username | password | salt | deleted | password_version
---------+-----------+----------------------------------+----------------------------------+---------+------------------
1 | admin | f6af2cbfdf011cb2e6d90ab74be131ef | 48QvleJcZdySDPoLSU9vV5Bip81H6YbV | f | sha256
2 | anonymous | | | t | sha1
3 | test | 7dd6cc44ab5ee991fbb1b27c6d49b100 | 4yYCpDSnWRd4ryDflJvm9OVOBjGkbzlf | f | sha256
(3 rows)
registry=# update harbor_user set salt='',password='' where user_id = 1;
UPDATE 1
重启harbor admin/Harbor12345
registry=# select user_id,username,password,salt,deleted,password_version from harbor_user order by user_id;
user_id | username | password | salt | deleted | password_version
---------+-----------+----------------------------------+----------------------------------+---------+------------------
1 | admin | 2fd1afe65dc5460e3a05b32f894893db | mtYqbEazoeHvZ4iubu1lDBFWC1CzixNU | f | sha256
2 | anonymous | | | t | sha1
3 | test | 7dd6cc44ab5ee991fbb1b27c6d49b100 | 4yYCpDSnWRd4ryDflJvm9OVOBjGkbzlf | f | sha256
(3 rows)