因此,我有一个名为spring
的用户,虽然我的sshd_config
是DenyUsers spring
,但我可以使用PuTTY登录到该用户。当然,我重新启动了SSH服务。
来自/etc/ssh/sshd_config
的非注释行:
Port xxxxx
Protocol 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
UsePrivilegeSeparation yes
KeyRegenerationInterval 3600
ServerKeyBits 1024
SyslogFacility AUTH
LogLevel INFO
LoginGraceTime 120
PermitRootLogin no
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
IgnoreRhosts yes
RhostsRSAAuthentication no
HostbasedAuthentication no
PermitEmptyPasswords no
ChallengeResponseAuthentication no
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
UsePAM yes
Match User myotheruser
PasswordAuthentication no
DenyUsers spring
我要查什么?
发布于 2019-01-15 08:32:48
放置,DenyUsers
之前的第一个或唯一的Match User
。或者在第一个AllowUsers
之前使用Match User
指令只允许您想要的用户。
或者使用这两种指令,例如:
AllowUsers somealloweduser
DenyUsers *
允许指令和拒绝指令像防火墙表一样执行,订单很重要。以上将允许一些人,并拒绝所有其他人。如果拒绝是第一次,没有人能够连接。
发布于 2019-01-16 05:57:41
我怀疑DenyUsers指令被视为Match子句的一部分,而不是无条件的限制。所以我试着把它移到匹配项上方,看看这是否有帮助。
https://unix.stackexchange.com/questions/494630
复制