sshd_config match negate address
tl;dr
Match Address *,!192.168.1.0/24
Negating address in match statement in sshd_config
I was locking down my ssh server configuration on a host, so that it will not accept password auth from outside a certain IP address range. I had to learn how to get the Match Address directive to work with a negation. To make it work, you need to insert a wildcard before you then state the exclusion.
Match Address *,!192.168.1.0/24
And then I added the directives for this matched IP address range.
AuthenticationMethods publickey
PubkeyAuthentication yes
PasswordAuthentication no
X11Forwarding no
Comments