Hostname
lastmod 2026-03-02created 2015-07-263 edits
Changing the name
Edit the contents of the /etc/hostname file or use the hostnamectl command.
hosts.allow, hosts.deny
These two files can be used to restrict access. Taking SSH access restriction as an example, it works as follows.
First, an example that allows SSHD access for specific IPs (ranges) is as follows.
#
# hosts.allow This file describes the names of the hosts which are
# allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
sshd: 113.157.124.168, 135.79.246.
sshd: 192.168.0.
All IPs not matching the above are denied access to SSHD.
#
# hosts.deny This file describes the names of the hosts which are
# *not* allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow. In particular
# you should know that NFS uses portmap!
sshd: ALL