暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

GBase 8a数据库登录最大登录错误次数 login_attempt_max。账号锁定lock和手工unlokc解锁

墨天轮DB 2022-04-29
457

GBase 8a数据库集群,通过login_attempt_max参数控制尝试登陆的密码错误次数,超过了会将账号锁定。默认为0不限制次数。

参数

login_attempt_max

注意:该参数,对gbase用户不生效,因为该用户,是数据库内部通信用的。其它用户,包括root,都生效。

默认值

0 不限制
其它整数 达到这个次数后,账号被lock

修改方式

通过修改gcluster的配置文件。不允许set。

样例

如下将次数改成3次,然后重启gclusterd服务。测试密码错误

[gbase@localhost ~]$ gccli -uabc -pabc ERROR 1045 (28000): Access denied for user 'abc'@'127.0.0.1' (using password: YES) [gbase@localhost ~]$ gccli -uabc -pabc ERROR 1045 (28000): Access denied for user 'abc'@'127.0.0.1' (using password: YES) [gbase@localhost ~]$ gccli -uabc -pabc ERROR 1829 (HY000): Access denied for user 'abc'@'%'. Account is locked. [gbase@localhost ~]$ gccli -uabc -pabc ERROR 1829 (HY000): Access denied for user 'abc'@'%'. Account is locked. [gbase@localhost ~]$ gccli -uabc -pabc ERROR 1829 (HY000): Access denied for user 'abc'@'%'. Account is locked. [gbase@localhost ~]$ gccli -uabc -pabcd ERROR 1829 (HY000): Access denied for user 'abc'@'%'. Account is locked.

手工解锁

需要使用管理员用户gbase,注意root也会被锁定,只有gbase不会。

gbase> alter user abc account unlock; Query OK, 0 rows affected (Elapsed: 00:00:00.01) gbase> ^CAborted [gbase@localhost ~]$ gccli -uabc -pabcd

特殊账号测试

gbase用户不生效

超过了设置的5次,依然可以登录。

[gbase@rh6-1 ~]$ gccli -ugbase -p123 ERROR 1045 (28000): Access denied for user 'gbase'@'localhost' (using password: YES) [gbase@rh6-1 ~]$ gccli -ugbase -p123 ERROR 1045 (28000): Access denied for user 'gbase'@'localhost' (using password: YES) [gbase@rh6-1 ~]$ gccli -ugbase -p123 ERROR 1045 (28000): Access denied for user 'gbase'@'localhost' (using password: YES) [gbase@rh6-1 ~]$ gccli -ugbase -p123 ERROR 1045 (28000): Access denied for user 'gbase'@'localhost' (using password: YES) [gbase@rh6-1 ~]$ gccli -ugbase -p123 ERROR 1045 (28000): Access denied for user 'gbase'@'localhost' (using password: YES) [gbase@rh6-1 ~]$ gccli -ugbase -p123 ERROR 1045 (28000): Access denied for user 'gbase'@'localhost' (using password: YES) [gbase@rh6-1 ~]$ gccli -ugbase -p123 ERROR 1045 (28000): Access denied for user 'gbase'@'localhost' (using password: YES)

root生效

第5次,账号被锁了。

[gbase@rh6-1 ~]$ gccli -uroot -p123 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) [gbase@rh6-1 ~]$ gccli -uroot -p123 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) [gbase@rh6-1 ~]$ gccli -uroot -p123 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) [gbase@rh6-1 ~]$ gccli -uroot -p123 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) [gbase@rh6-1 ~]$ gccli -uroot -p123 ERROR 1829 (HY000): Access denied for user 'root'@'%'. Account is locked. [gbase@rh6-1 ~]$ gccli -uroot -p123 ERROR 1829 (HY000): Access denied for user 'root'@'%'. Account is locked. [gbase@rh6-1 ~]$ gccli -uroot -p123 ERROR 1829 (HY000): Access denied for user 'root'@'%'. Account is locked.
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论