有2个用户:
root
seconduser
我需要更改他们两个的密码,所以我做到了。之后,我access denied在以seconduser. 但是,我仍然可以root使用新密码以用户身份登录。
为了允许seconduser,我etc/ssh/sshd_config通过在文档底部添加以下内容进行编辑:
AllowUsers seconduser
之后重新启动 sshd 并注销 root 以尝试以seconduser. 这不起作用(同样的错误:访问被拒绝),但现在我也为root用户得到了同样的结果。我基本上被排除在外,无法访问服务器。
如何重新获得访问权限?服务器运行 CentOS 6.8。
任何帮助深表感谢。
简短的回答:你把自己搞砸了,必须亲自接触机器才能拧下它。
长答案:您误解了AllowUsers指令的含义和语法。
从联机帮助页:
AllowUsers
This keyword can be followed by a list of user name patterns,
separated by spaces. If specified, login is allowed only for
user names that match one of the patterns. Only user names are
valid; a numerical user ID is not recognized. By default, login
is allowed for all users. If the pattern takes the form
USER@HOST then USER and HOST are separately checked, restricting
logins to particular users from particular hosts. HOST criteria
may additionally contain addresses to match in CIDR
address/masklen format. The allow/deny directives are processed
in the following order: DenyUsers, AllowUsers, DenyGroups, and
finally AllowGroups.
See PATTERNS in ssh_config(5) for more information on patterns.
Run Code Online (Sandbox Code Playgroud)
请注意第二句:“如果指定,则仅允许匹配其中一种模式的用户名登录”
当您向您添加 seconduser(且仅 seconduser)时,AllowedUsers您锁定了所有其他用户。包括根。无论您在 ssh 中配置错误还是在更改 seconduser 的密码时输入错误都会阻止您以该用户身份登录。
实际上不可能获得更多关于您为什么无法登录的信息;毕竟,ssh无法判断您是试图暴力破解密码的敌对行为者,还是忘记了实际密码的合法用户,而向前者提供有关如何成功登录的有用提示会带来安全风险.
如果您使用的是标准的 unix openSSH,您可以尝试使用ssh -vvv连接 并查看握手中是否有任何提示您可能做错的事情,而不是没有输入正确的凭据,但鉴于 root确实有效,直到您砰的一声关上门就你自己而言,那部分可能不是问题。
| 归档时间: |
|
| 查看次数: |
15883 次 |
| 最近记录: |