回答:
の最後にMatchブロックを使用します/etc/ssh/sshd_config:
# Global settings
…
PasswordAuthentication no
…
# Settings that override the global settings for matching IP addresses only
Match address 192.0.2.0/24
PasswordAuthentication yes
次に、sshdサービスに設定を再ロードするように指示します。
service ssh reload
sshd_configPython ではない;)
Matchブロックは、次のMatchディレクティブまで、またはファイルの終わりまで続きます。そのため、最後に配置する必要があります。
あなたは付け加えられます:
AllowUsers user1@192.168.*.*, user2@192.168.*.*
これはデフォルトの動作を変更し、すべてのホストから他のすべてのユーザーを実際に拒否します。OpenSshバージョン5.1以降で使用可能な一致ブロック。
man sshd_configはAllowGroups、同じように見えますAllowUsersがAllowUsers、に優先するようAllowGroupsです。