I have an sshd config that looks like this:
DenyUsers * AllowUsers root@* AllowUsers user1@* AllowUsers user2@* The sshd docs state that "The allow/deny users directives are processed in the following order: DenyUsers, AllowUsers", and the intention here is that nobody should be allowed to use ssh apart from the 3 listed users.
However, this doesn't work: if any of these users tries to connect over ssh, the logs (systemctl status ssh) state that "User foo from a.b.c.d not allowed because listed in DenyUsers".
So, it looks like DenyUsers always has priority (I'm on OpenSSH_8.9p1, on Ubuntu 22.04).
Is there some way around this? I need to have some form of DenyUsers because configuration on this system is automated, and all 3 users could be denied access by commenting out their individual AllowUsers, which would give:
# AllowUsers root@* # AllowUsers user1@* # AllowUsers user2@* The problem now is that everybody is allowed access, instead of nobody.