Allow ssh only as a single user or from specific IPs

The following are the relevant config bits in /etc/ssh/sshd_config

# disable password authentication globally
PasswordAuthentication no

Either by username:
# now re-enable it down at the very end of the sshd_config file like thus
Match User rack
PasswordAuthentication yes

or by IP:

# now re-enable it down at the very end of the sshd_config file like thus
Match Address 72.3.128.84,69.20.0.1,50.57.22.125,120.136.34.22,212.100.225.49,212.100.225.42,119.9.4.2,67.192.155.96/27,120.136.33.192/27,
69.20.80.0/28,72.4.123.216,89.234.21.64/28,173.203.5.160/27,173.203.32.136/29,64.49.200.192/27,166.78.7.146,50.56.249.239,166.78.107.18,
162.209.4.155,95.138.174.55,162.13.1.53,119.9.12.91,119.9.12.98
PasswordAuthentication yes

About vicki

Welcome to the Sovereign Republic of Vickistan. I am the President here. Lucky me! No taxes or laws yet. Lucky you!
This entry was posted in Linux, SSH. Bookmark the permalink.