How to set up SSH passwordless key authentication for remote access only, allowing local users to use passwords

This should do the trick:

PubkeyAuthentication yes
PasswordAuthentication no
Match Address 192.168.5.* PasswordAuthentication yes

The first two lines will enable pubkey authentication by default. The last line will override the other two lines for the matched network (192.168.5.0/24).


The newline after the match condition is significant. This should work:

PasswordAuthentication no
Match Address 192.168.5.0/24
PasswordAuthentication yes

EDIT: I'm surprised the other answer worked! It didn't work for me. Well, this way you should be able to use a CIDR netmask.