searchusermenu
  • 发布文章
  • 消息中心
点赞
收藏
评论
分享
原创

harbor服务忘记admin密码的处理方法

2024-06-07 09:50:07
6
0

操作流程:

1、进入harbor数据库容器

```shell
kubectl exec -it harbor-harbor-database-0  -n harbor -- /bin/bash
```

2、进入postgresql数据库

```shell
psql -U postgres -d postgres -h 127.0.0.1 -p 5432
```

3、切换到registry数据库

```shell
postgres=# \c registry
```

4、查看现有账号

```shell
registry=# select * from harbor_user;
 user_id | username  |         email         |             password             |    realname    |    comment     | deleted | reset_uuid |               salt         
      | sysadmin_flag |       creation_time        |        update_time         | password_version 
---------+-----------+-----------------------+----------------------------------+----------------+----------------+---------+------------+----------------------------
------+---------------+----------------------------+----------------------------+------------------
       2 | anonymous | anonymous@example.com |                                  | anonymous user | anonymous user | t       |            |                            
      | f             | 2022-05-09 14:12:03.647632 | 2022-06-16 17:18:01.383232 | sha1
       1 | admin     | admin@example.com     | b56a34d6c105ffa3f3ebde1397900999 | system admin   | admin user     | f       |            | ay3bp5yc9fw8lplxih43nsrplab
h8se3 | t             | 2022-05-09 14:12:03.647632 | 2022-06-16 17:18:01.383232 | sha1
(2 rows)

```

5、update admin数据记录, 将密码重置为`Harbor12345`

```shell
update harbor_user set password='a71a7d0df981a61cbb53a97ed8d78f3e', salt='ah3fdh5b7yxepalg9z45bu8zb36sszmr' where username='admin';
```

6、退出数据库

```shell
\q
```

7、使用web ui登录harbor,修改admin密码为强密码

0条评论
0 / 1000