X
X
X
X

Knowledge Base

HomepageKnowledge BaseProblem of LinuxLinux restricts ip for ssh login

Linux restricts ip for ssh login

/etc/hosts.allow add:
sshd:192.168.0.1:allow #Allow SSH login from the IP address 192.168.0.1
sshd:192.168.0.:allow #Allow users with the IP address of 192.168.0.1/24 to log in. Multiple network segments can be separated by commas, such as 192.168.0.,192.168.1.:allow

/etc/hosts.deny add:
sshd:ALL #Reject all IP

When the two files hosts.allow and hosts.deny set rules at the same time, the priority of the rules in the hosts.allow file is higher. After this method is set, the server only allows SSH login from the IP address 192.168.0.1, and all other IPs will be rejected .

Can't find the information you are looking for?

Create a Support Ticket
Did you find it useful?
(62 times viewed / 0 people found it helpful)

Top