In short, the /etc/hosts.allow file specifies which services and hosts are allowed access to the system, whereas the /etc/hosts.deny file specifies which services and hosts are not allowed access. These files can be configured by adding specific rules to the files.
/etc/hosts.allow
/etc/hosts.allow
ataker@htb[/htb]$ cat /etc/hosts.allow# Allow access to SSH from the local networksshd : 10.129.14.0/24# Allow access to FTP from a specific hostftpd : 10.129.14.10# Allow access to Telnet from any host in the inlanefreight.local domaintelnetd : .inlanefreight.local
/etc/hosts.deny
/etc/hosts.deny
ataker@htb[/htb]$ cat /etc/hosts.deny# Deny access to all services from any host in the inlanefreight.com domainALL : .inlanefreight.com# Deny access to SSH from a specific hostsshd : 10.129.22.22# Deny access to FTP from hosts with IP addresses in the range of 10.129.22.0 to 10.129.22.255ftpd : 10.129.22.0/24