记一次误操作引起的cacti管理员账户登陆失败及其解决办法
【问题描述】昨晚误操作,将settings->Authentication->Special Users->Guest User设置为了admin.
http://s2.运维网.com/wyfs02/M00/76/7F/wKioL1ZVGI6glc-4AAnK0Bd7gIc526.jpg
然后用admin账户访问cacti时始终无法登陆,一直停留在登陆界面,也无报错信息。
http://s3.运维网.com/wyfs02/M02/76/84/wKioL1ZVXYTD9_NDAAEHFkG_EL8944.jpg
【解决办法】
分别查看Apache访问及错误日之后也没发现异常。遂百度、好搜,几十分钟过后还是未果,最后查看浏览器地址栏:
http://s4.运维网.com/wyfs02/M01/76/84/wKioL1ZVXqWDg7o0AAA6IJHn1cE991.jpg
推断setting选项对应的后台页面应为settings.php,vim进去之后发现以下几行代码:
http://s1.运维网.com/wyfs02/M02/76/81/wKiom1ZVIAqR8TzYAAMZPkzOthE458.jpg
猜测是设置后的值存放在数据库中,进入数据库查看对应表。
mysql> show tables like '%set%';
+-------------------------+
| Tables_in_cacti (%set%) |
+-------------------------+
| settings |
| settings_graphs |
| settings_tree |
| weathermap_settings |
+-------------------------+
4 rows in set (0.00 sec)
mysql> desc settings;
+-------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+-------+
| name| varchar(50)| NO | PRI | | |
| value | varchar(255) | NO | | | |
+-------+--------------+------+-----+---------+-------+
2 rows in set (0.00 sec) 对照settings表结构后,发现settings.php页面中涉及的字段完全吻合。
将guest_user字段的值设置为guest(未更改前的值)
mysql> update settings set value = 'guest' where name = 'guest_user';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1Changed: 1Warnings: 0
mysql> select * from settings where name = 'guest_user';
+------------+-------+
| name | value |
+------------+-------+
| guest_user | guest |
+------------+-------+
1 row in set (0.00 sec) 重新登陆后,即可正常进入cacti界面。
http://s4.运维网.com/wyfs02/M00/76/84/wKioL1ZVX6PxwtulAAGbWwxPkiM174.jpg
页:
[1]