SSH access for specific IPs on Ubuntu Server
Step 1: Blocking access from all IPs
Add the following line to the /etc/hosts.deny file:
sshd: ALL
Step 2: Allowing access from specific IP
Add the following line to the /etc/hosts.allow file:
- For specific IP:
sshd : 99.151.250.7
- List of IPs:
sshd: 172.168.0.21, 10.83.33.77, 10.63.152.9, 10.12.100.11, 10.82.192.2
- Specific subnet:
sshd: 172.168.0.
It’s real test case on Ubuntu Server 20.04.4 LTS.