1HOSTNAME(5)                        hostname                        HOSTNAME(5)
2
3
4

NAME

6       hostname - Local hostname configuration file
7

SYNOPSIS

9       /etc/hostname
10

DESCRIPTION

12       The /etc/hostname file configures the name of the local system. Unless
13       overridden as described in the next section, systemd(1) will set this
14       hostname during boot using the sethostname(2) system call.
15
16       The file should contain a single newline-terminated hostname string.
17       Comments (lines starting with a "#") are ignored. The hostname should
18       be composed of up to 64 7-bit ASCII lower-case alphanumeric characters
19       or hyphens forming a valid DNS domain name. It is recommended that this
20       name contains only a single label, i.e. without any dots. Invalid
21       characters will be filtered out in an attempt to make the name valid,
22       but obviously it is recommended to use a valid name and not rely on
23       this filtering.
24
25       You may use hostnamectl(1) to change the value of this file during
26       runtime from the command line. Use systemd-firstboot(1) to initialize
27       it on mounted (but not booted) system images.
28

HOSTNAME SEMANTICS

30       systemd(1) and the associated tools will obtain the hostname in the
31       following ways:
32
33       •   If the kernel commandline parameter systemd.hostname= specifies a
34           valid hostname, systemd(1) will use it to set the hostname during
35           early boot, see kernel-command-line(7),
36
37       •   Otherwise, the "static" hostname specified by /etc/hostname as
38           described above will be used.
39
40       •   Otherwise, a transient hostname may be set during runtime, for
41           example based on information in a DHCP lease, see systemd-
42           hostnamed.service(8). Both NetworkManager[1] and systemd-
43           networkd.service(8) allow this. Note that systemd-
44           hostnamed.service(8) gives higher priority to the static hostname,
45           so the transient hostname will only be used if the static hostname
46           is not configured.
47
48       •   Otherwise, a fallback hostname configured at compilation time will
49           be used ("fedora").
50
51       Effectively, the static hostname has higher priority than a transient
52       hostname, which has higher priority than the fallback hostname.
53       Transient hostnames are equivalent, so setting a new transient hostname
54       causes the previous transient hostname to be forgotten. The hostname
55       specified on the kernel command line is like a transient hostname, with
56       the exception that it has higher priority when the machine boots. Also
57       note that those are the semantics implemented by systemd tools, but
58       other programs may also set the hostname.
59

HISTORY

61       The simple configuration file format of /etc/hostname originates from
62       Debian GNU/Linux.
63

SEE ALSO

65       systemd(1), sethostname(2), hostname(1), hostname(7), machine-id(5),
66       machine-info(5), hostnamectl(1), systemd-hostnamed.service(8), systemd-
67       firstboot(1)
68

NOTES

70        1. NetworkManager
71           https://developer.gnome.org/NetworkManager/stable/
72
73
74
75systemd 250                                                        HOSTNAME(5)
Impressum