The file /etc/HOSTNAME
on SuSE-Linux contains the host name.
Should this be the full qualified domain name, or the short name (without ".")?
Related question: socket.getfqdn() returns no domain, but socket.gethostname() does?
hostnameopensusesystemd
The file /etc/HOSTNAME
on SuSE-Linux contains the host name.
Should this be the full qualified domain name, or the short name (without ".")?
Related question: socket.getfqdn() returns no domain, but socket.gethostname() does?
Best Answer
Please note that AFAIK the upper-case
/etc/HOSTNAME
is specific to SuSe systems, but that should be a symbolic link to the a lowercase file name/etc/hostname
, which is used by systemd and should be therefore be present on other distributions as well.The recommend systemd utility
hostnamectl
distinguishes three different hostnames:/etc/machine-info
the static hostname which is used to initialize the kernel hostname at boot (e.g. "lennarts-laptop"), which is stored in
/etc/hostname
the transient hostname which is a default received from network configuration.
The manual page for the hostname configuration file
man 5 hostname
doesn't really explicitly use the term FQDN but states:Where the "no dots" is the only hint that the hostname file should only contain the system host name component, without a domain suffix and therefore not a FQDN.
The manual for the
hostname
command is more explicit (man 1 hostname
) :In other words, the hostname is NOT the FQDN.
And then on how to configure the FQDN:
BTW: If you do use a FQDN such as
myhost.example.com
as hostname and in/etc/hostname
, things likednsdomain
andhostname -d
will return empty strings and will NOT split that string at the first dot into a DNS hostname componentmyhost
and a domain name componentexample.com