Librenms强制修改密码

本来没这事的,不小心在网页点了修改密码,填充的自动生成的密码,又没保存生成的密码,改密码又得需要原来的密码,只能通过数据库改回来了。

image


所有的具体操作步骤:
1、找一个在线生成密码的网站,例如https://onlinephp.io/password-hash

2、生成一个新的hash密码,例如“@@123123

image

3、将生成的密码写到数据库里就好了:

mysql -uroot -p
use librenms;
select * from users;
update users set password='$2y$10$vpb8ED0bzNHRORUx4OVVAu/Co.pkxUusOHk/XjhtF/g7EEMRt9eHu' where user_id=1;

接下来下面的都是废话,可供参考
操作前可以查询一下数据库,可以看到存在「librenms」数据库:

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| librenms           |
| mysql              |
| performance_schema |
| sys                |
+--------------------+

选择数据库后可以看一下数据表:

MariaDB [(none)]> use librenms
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [librenms]> show tables;
+--------------------------------+
| Tables_in_librenms             |
+--------------------------------+
| **********                     |
| users                          |
| ***********                    |
+--------------------------------+

找一下「users」表内的用户id:

MariaDB [librenms]> select * from users;
+---------+-----------+---------+----------+--------------------------------------------------------------+----------+---------------------+-------+-------------------+---------------------+---------------------+----------------+---------+
| user_id | auth_type | auth_id | username | password                                                     | realname | email               | descr | can_modify_passwd | created_at          | updated_at          | remember_token | enabled |
+---------+-----------+---------+----------+--------------------------------------------------------------+----------+---------------------+-------+-------------------+---------------------+---------------------+----------------+---------+
|       1 | mysql     | 1       | admin    | $2y$10$dQvSm3Dl6JUH4kG5a6owSetYtrPBOB/yMaONApISWQU3y4vHBkUoG |          | admin@outlook.com   |       |                 1 | 2024-11-30 11:09:31 | 2024-12-11 09:18:17 | NULL           |       1 |
+---------+-----------+---------+----------+--------------------------------------------------------------+----------+---------------------+-------+-------------------+---------------------+---------------------+----------------+---------+
1 row in set (0.000 sec)

可以根据「user_id」修改用户密码为hash后的密码:

update users set password='$2y$10$vpb8ED0bzNHRORUx4OVVAu/Co.pkxUusOHk/XjhtF/g7EEMRt9eHu' where user_id=1;

然后web上admin账号就可以使用“@@123123”来登录了。

posted @ 2024-12-11 11:44  Ojox  阅读(211)  评论(0)    收藏  举报