Access Denied : Unable to login
2023-12-10 本文已影响0人
yangqing
环境
- CentOS 7
问题
- 无法登录
root通过允许的 IP 的帐户/etc/hosts.allow文件。 - 重置
root用户密码允许登录。但是,重置密码 2-3 小时后root用户抛出错误Access Denied当尝试登录时。
解决
- 添加逗号
,将允许的 IP 分开/etc/hosts.allow文件
/etc/hosts.allow
====
...
...
sshd: 10.10.10.1, 10.10.10.2, 10.10.10.3, 10.10.10.4, 10.10.10.5, 10.10.10.6, 10.10.10.7, 10.10.10.8, 10.10.10.9, 10.10.10.10
====
根本原因
- 文件末尾添加了一些IP
/etc/hosts.allow没有分隔符(逗号,) 添加。
/etc/hosts.allow
====
...
...
sshd: 10.10.10.1, 10.10.10.2, 10.10.10.3, 10.10.10.4, 10.10.10.5, 10.10.10.6, 10.10.10.7 10.10.10.8 10.10.10.9 10.10.10.10
====
诊断步骤
- 核实
/etc/hosts.allow文件
/etc/hosts.allow
====
...
...
sshd: 10.10.10.1, 10.10.10.2, 10.10.10.3, 10.10.10.4, 10.10.10.5, 10.10.10.6, 10.10.10.7 10.10.10.8 10.10.10.9 10.10.10.10
====
- 核实
/etc/hosts.deny文件
/etc/hosts.deny
====
...
...
sshd: ALL
====