]>
Commit | Line | Data |
---|---|---|
dbc4fbae LP |
1 | <?xml version='1.0'?> <!--*-nxml-*--> |
2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" | |
12b42c76 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
dbc4fbae LP |
4 | |
5 | <!-- | |
6 | This file is part of systemd. | |
7 | ||
8 | Copyright 2012 Lennart Poettering | |
9 | ||
10 | systemd is free software; you can redistribute it and/or modify it | |
11 | under the terms of the GNU Lesser General Public License as published by | |
12 | the Free Software Foundation; either version 2.1 of the License, or | |
13 | (at your option) any later version. | |
14 | ||
15 | systemd is distributed in the hope that it will be useful, but | |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | Lesser General Public License for more details. | |
19 | ||
20 | You should have received a copy of the GNU Lesser General Public License | |
21 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
22 | --> | |
23 | ||
dfdebb1b | 24 | <refentry id="hostnamectl" conditional='ENABLE_HOSTNAMED' |
798d3a52 ZJS |
25 | xmlns:xi="http://www.w3.org/2001/XInclude"> |
26 | ||
27 | <refentryinfo> | |
28 | <title>hostnamectl</title> | |
29 | <productname>systemd</productname> | |
30 | ||
31 | <authorgroup> | |
32 | <author> | |
33 | <contrib>Developer</contrib> | |
34 | <firstname>Lennart</firstname> | |
35 | <surname>Poettering</surname> | |
36 | <email>lennart@poettering.net</email> | |
37 | </author> | |
38 | </authorgroup> | |
39 | </refentryinfo> | |
40 | ||
41 | <refmeta> | |
42 | <refentrytitle>hostnamectl</refentrytitle> | |
43 | <manvolnum>1</manvolnum> | |
44 | </refmeta> | |
45 | ||
46 | <refnamediv> | |
47 | <refname>hostnamectl</refname> | |
48 | <refpurpose>Control the system hostname</refpurpose> | |
49 | </refnamediv> | |
50 | ||
51 | <refsynopsisdiv> | |
52 | <cmdsynopsis> | |
53 | <command>hostnamectl</command> | |
54 | <arg choice="opt" rep="repeat">OPTIONS</arg> | |
55 | <arg choice="req">COMMAND</arg> | |
56 | </cmdsynopsis> | |
57 | </refsynopsisdiv> | |
58 | ||
59 | <refsect1> | |
60 | <title>Description</title> | |
61 | ||
62 | <para><command>hostnamectl</command> may be used to query and | |
63 | change the system hostname and related settings.</para> | |
64 | ||
65 | <para>This tool distinguishes three different hostnames: the | |
66 | high-level "pretty" hostname which might include all kinds of | |
67 | special characters (e.g. "Lennart's Laptop"), the static hostname | |
68 | which is used to initialize the kernel hostname at boot (e.g. | |
89a16758 ZJS |
69 | "lennarts-laptop"), and the transient hostname which is a fallback |
70 | value received from network configuration. If a static hostname is | |
71 | set, and is valid (something other than localhost), then the | |
72 | transient hostname is not used.</para> | |
798d3a52 | 73 | |
7c9f396b LP |
74 | <para>Note that the pretty hostname has little restrictions on the characters and length used, while the static and |
75 | transient hostnames are limited to the usually accepted characters of Internet domain names, and 64 characters at | |
76 | maximum (the latter being a Linux limitation).</para> | |
798d3a52 ZJS |
77 | |
78 | <para>The static hostname is stored in | |
79 | <filename>/etc/hostname</filename>, see | |
80 | <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
81 | for more information. The pretty hostname, chassis type, and icon | |
82 | name are stored in <filename>/etc/machine-info</filename>, see | |
83 | <citerefentry><refentrytitle>machine-info</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para> | |
84 | ||
85 | <para>Use | |
86 | <citerefentry><refentrytitle>systemd-firstboot</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
87 | to initialize the system host name for mounted (but not booted) | |
88 | system images.</para> | |
89 | </refsect1> | |
90 | ||
91 | <refsect1> | |
92 | <title>Options</title> | |
93 | ||
94 | <para>The following options are understood:</para> | |
95 | ||
96 | <variablelist> | |
97 | <varlistentry> | |
98 | <term><option>--no-ask-password</option></term> | |
99 | ||
100 | <listitem><para>Do not query the user for authentication for | |
101 | privileged operations.</para></listitem> | |
102 | </varlistentry> | |
103 | ||
104 | <varlistentry> | |
105 | <term><option>--static</option></term> | |
106 | <term><option>--transient</option></term> | |
107 | <term><option>--pretty</option></term> | |
108 | ||
986cf85d LP |
109 | <listitem><para>If <command>status</command> is invoked (or no explicit command is given) and one of these |
110 | switches is specified, <command>hostnamectl</command> will print out just this selected hostname.</para> | |
111 | ||
112 | <para>If used with <command>set-hostname</command>, only the selected hostname(s) will be updated. When more | |
113 | than one of these switches are specified, all the specified hostnames will be updated. </para></listitem> | |
798d3a52 ZJS |
114 | </varlistentry> |
115 | ||
116 | <xi:include href="user-system-options.xml" xpointer="host" /> | |
117 | <xi:include href="user-system-options.xml" xpointer="machine" /> | |
118 | ||
119 | <xi:include href="standard-options.xml" xpointer="help" /> | |
120 | <xi:include href="standard-options.xml" xpointer="version" /> | |
121 | </variablelist> | |
122 | ||
123 | <para>The following commands are understood:</para> | |
124 | ||
125 | <variablelist> | |
126 | <varlistentry> | |
127 | <term><command>status</command></term> | |
128 | ||
129 | <listitem><para>Show current system | |
130 | hostname and related | |
131 | information.</para></listitem> | |
132 | </varlistentry> | |
133 | ||
134 | <varlistentry> | |
135 | <term><command>set-hostname <replaceable>NAME</replaceable></command></term> | |
136 | ||
0cce63da LP |
137 | <listitem><para>Set the system hostname to <replaceable>NAME</replaceable>. By default, this will alter the |
138 | pretty, the static, and the transient hostname alike; however, if one or more of <option>--static</option>, | |
139 | <option>--transient</option>, <option>--pretty</option> are used, only the selected hostnames are changed. If | |
140 | the pretty hostname is being set, and static or transient are being set as well, the specified hostname will be | |
141 | simplified in regards to the character set used before the latter are updated. This is done by removing special | |
142 | characters and spaces. This ensures that the pretty and the static hostname are always closely related while | |
143 | still following the validity rules of the specific name. This simplification of the hostname string is not done | |
144 | if only the transient and/or static host names are set, and the pretty host name is left untouched.</para> | |
798d3a52 ZJS |
145 | |
146 | <para>Pass the empty string <literal></literal> as the | |
147 | hostname to reset the selected hostnames to their default | |
148 | (usually <literal>localhost</literal>).</para></listitem> | |
149 | </varlistentry> | |
150 | ||
151 | <varlistentry> | |
152 | <term><command>set-icon-name <replaceable>NAME</replaceable></command></term> | |
153 | ||
154 | <listitem><para>Set the system icon name to | |
155 | <replaceable>NAME</replaceable>. The icon name is used by some | |
156 | graphical applications to visualize this host. The icon name | |
157 | should follow the <ulink | |
158 | url="http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html">Icon | |
159 | Naming Specification</ulink>.</para> | |
160 | ||
161 | <para>Pass an empty string to reset the icon name to the | |
162 | default value, which is determined from chassis type (see | |
163 | below) and possibly other parameters.</para></listitem> | |
164 | </varlistentry> | |
165 | ||
166 | <varlistentry> | |
167 | <term><command>set-chassis <replaceable>TYPE</replaceable></command></term> | |
168 | ||
169 | <listitem><para>Set the chassis type to | |
170 | <replaceable>TYPE</replaceable>. The chassis type is used by | |
171 | some graphical applications to visualize the host or alter | |
172 | user interaction. Currently, the following chassis types are | |
173 | defined: | |
174 | <literal>desktop</literal>, | |
175 | <literal>laptop</literal>, | |
176 | <literal>server</literal>, | |
177 | <literal>tablet</literal>, | |
178 | <literal>handset</literal>, | |
179 | <literal>watch</literal>, | |
180 | <literal>embedded</literal>, | |
181 | as well as the special chassis types | |
182 | <literal>vm</literal> and | |
183 | <literal>container</literal> for virtualized systems that lack | |
184 | an immediate physical chassis.</para> | |
185 | ||
186 | <para>Pass an empty string to reset the chassis type to the | |
187 | default value which is determined from the firmware and | |
188 | possibly other parameters.</para> | |
189 | </listitem> | |
190 | </varlistentry> | |
191 | ||
192 | <varlistentry> | |
193 | <term><command>set-deployment <replaceable>ENVIRONMENT</replaceable></command></term> | |
194 | ||
195 | <listitem><para>Set the deployment environment description. | |
196 | <replaceable>ENVIRONMENT</replaceable> must be a single word | |
197 | without any control characters. One of the following is | |
198 | suggested: | |
199 | <literal>development</literal>, | |
200 | <literal>integration</literal>, | |
201 | <literal>staging</literal>, | |
202 | <literal>production</literal>. | |
203 | </para> | |
204 | ||
205 | <para>Pass an empty string to reset to the default empty | |
206 | value.</para> | |
207 | </listitem> | |
208 | </varlistentry> | |
209 | ||
210 | <varlistentry> | |
211 | <term><command>set-location <replaceable>LOCATION</replaceable></command></term> | |
212 | ||
213 | <listitem><para>Set the location string for the system, if it | |
214 | is known. <replaceable>LOCATION</replaceable> should be a | |
215 | human-friendly, free-form string describing the physical | |
216 | location of the system, if it is known and applicable. This | |
217 | may be as generic as <literal>Berlin, Germany</literal> or as | |
218 | specific as <literal>Left Rack, 2nd Shelf</literal>.</para> | |
219 | ||
220 | <para>Pass an empty string to reset to the default empty | |
221 | value.</para> | |
222 | </listitem> | |
223 | </varlistentry> | |
224 | </variablelist> | |
225 | </refsect1> | |
226 | ||
227 | <refsect1> | |
228 | <title>Exit status</title> | |
229 | ||
230 | <para>On success, 0 is returned, a non-zero failure code | |
231 | otherwise.</para> | |
232 | </refsect1> | |
233 | ||
234 | <refsect1> | |
235 | <title>See Also</title> | |
236 | <para> | |
237 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
238 | <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
239 | <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
240 | <citerefentry><refentrytitle>machine-info</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
241 | <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
242 | <citerefentry><refentrytitle>systemd-hostnamed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, | |
243 | <citerefentry><refentrytitle>systemd-firstboot</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
244 | </para> | |
245 | </refsect1> | |
dbc4fbae LP |
246 | |
247 | </refentry> |