Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
193
rated 0 times [  193] [ 0]  / answers: 1 / hits: 235959  / 2 Years ago, fri, january 21, 2022, 5:11:01

I'd like to allow SSH password authentication from only a certain subnet. I see the option to disallow it globally in /etc/ssh/sshd_config:



# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes


Is there a way to apply this configuration to a select range of IP addresses?


More From » ssh

 Answers
6

Use a Match block at the end of /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


Then tell the sshd service to reload its configuration:



service ssh reload

[#40545] Sunday, January 23, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rialhirt

Total Points: 422
Total Questions: 113
Total Answers: 120

Location: France
Member since Sun, May 15, 2022
2 Years ago
rialhirt questions
Mon, May 24, 21, 18:24, 3 Years ago
Tue, May 10, 22, 21:43, 2 Years ago
Thu, Feb 16, 23, 16:32, 1 Year ago
Mon, Jun 13, 22, 03:02, 2 Years ago
;