Dynamically updating etchosts
Depending on what you're looking to do, I would use a one line bash command with sed (or something similar) to edit the file.You can add the command to the "execute command" section of files and processes in a policy.To restrict access to your Unix or Linux machine, you must modify the /etc/hosts.allow and /etc/files.These files are used by the tcpd (tcp wrapper) and sshd programs to decide whether or not to accept a connection coming in from another IP address.This is why Another possible use is to redirect traffic intended for a specific host to the localhost, thus preventing any communication with the given host.
Since each machine can have several network cards, and several interfaces on each card, one single computer can have several names in the domain name system. This is a practical means of recovering information from the kernel (by listing virtual files) and communicating them to it (by writing to virtual files).Worse, if you have a large HOSTS file (which is what I suggest), the DNS client chokes your entire PC.The DNS client acts as an intermediate step looking up (and remembering) internet names and addresses on your PC.in particular is designed to provide access to internal kernel objects, especially those representing the various devices in the system.
The kernel can, thus, share various pieces of information: the status of each device (for example, if it is in energy saving mode), whether it is a removable device, etc.ITS recommends using the configuration shown in the following /etc/hosts.allow file, to permit connections to any services protected by the tcpd or sshd from # # hosts.allow This file describes the names of # the hosts that are allowed to use # the local INET services, as decided # by the '/usr/sbin/tcpd' server. ALL: .# # This file describes the names of # the hosts that are *not* allowed # to use the local INET services, as # decided by the '/usr/sbin/tcpd' # server.