HOSTNAMED(8)

NAME
hostnamed - D-Bus hostname management daemon for non-systemd Linux systems

SYNOPSIS
/usr/libexec/hostnamed [--debug]

DESCRIPTION
hostnamed is a standalone system daemon that implements the org.freedesktop.hostname1 D-Bus interface using direct D-Bus activation, with no dependency on systemd. It exposes the same hostname and machine-identity properties as systemd-hostnamed(8) on systemd-based distributions, allowing desktop tools such as gnome-control-center to read and edit the system's hostname and related machine metadata on systems that use elogind and a D-Bus/PolKit stack without systemd.

hostnamed does not poll or hold any files open for writing on its own initiative. Instead it watches its source files with inotify(7) and re-reads them whenever they change, regardless of who changed them — the bundled hostnamectl(1) client, a hand edit, or any other tool. After a resync it emits PropertiesChanged on the D-Bus object for every property whose value actually changed.

hostnamed is normally started on demand by D-Bus activation when a client first calls a method or reads a property on the org.freedesktop.hostname1 bus name. It can also be started manually for debugging.

OPTIONS

--debug
    Enable verbose debug logging to standard error in addition to syslog.

D-BUS INTERFACE
hostnamed registers the object /org/freedesktop/hostname1 on the system bus, implementing the org.freedesktop.hostname1 interface.

  Properties
All properties are read-only over D-Bus; values are changed via the Set* methods described below, or by editing the underlying files directly (see FILES), which hostnamed picks up automatically.

Hostname (s)
    The transient hostname, as returned by gethostname(2).

StaticHostname (s)
    The hostname persisted to the static hostname file (see FILES).

PrettyHostname (s)
    A human-readable, free-form display name for the machine, stored as PRETTY_HOSTNAME in /etc/machine-info. Unlike StaticHostname, this value is not used for name resolution and may contain spaces and mixed case. When SetPrettyHostname is called with a value that contains a dot — as happens when a desktop shell populates both the static and pretty hostname from the same text field — hostnamed keeps only the portion before the first dot, so the pretty name does not end up as a dotted hostname.

DefaultHostname (s)
    The compiled-in or distribution default hostname, used when no static or transient hostname is configured.

HostnameSource (s)
    One of `static', `transient', or `default', indicating which mechanism currently determines Hostname.

IconName (s)
    A freedesktop icon name (e.g. `computer-desktop', `computer-laptop') describing the machine's form factor, taken from /etc/machine-info or derived from the SMBIOS chassis type when unset.

Chassis (s)
    A short chassis class string such as `desktop', `laptop', `server', `tablet', or `handset', taken from /etc/machine-info or derived from SMBIOS chassis-type data under /sys/class/dmi/id.

Deployment (s)
    A free-form deployment label (e.g. `production', `staging'), stored in /etc/machine-info.

Location (s)
    A free-form physical location string, stored in /etc/machine-info.

KernelName (s)
    The kernel name as reported by uname(2) (typically `Linux').

KernelRelease (s)
    The kernel release string from uname(2).

KernelVersion (s)
    The kernel version string from uname(2).

OperatingSystemPrettyName (s)
    The PRETTY_NAME field from /etc/os-release.

OperatingSystemCPEName (s)
    The CPE_NAME field from /etc/os-release, if present.

OperatingSystemHomeURL (s)
    The HOME_URL field from /etc/os-release, if present.

HardwareVendor (s)
    The system board vendor, read from /sys/class/dmi/id/board_vendor.

HardwareModel (s)
    The system product name, read from /sys/class/dmi/id/product_name.

FirmwareVersion (s)
    The BIOS/firmware version string, read from /sys/class/dmi/id/bios_version.

FirmwareDate (t)
    The BIOS/firmware release date, expressed as a uint64 count of microseconds since the UNIX epoch (UTC), per the org.freedesktop.hostname1 interface specification. The value is parsed from the `MM/DD/YYYY' date string in /sys/class/dmi/id/bios_date. If the source date is absent or cannot be parsed, this property is set to UINT64_MAX.

  Methods

SetHostname(s name, b interactive)
    Sets the transient hostname via sethostname(2). Requires the org.freedesktop.hostname1.set-hostname PolKit action.

SetStaticHostname(s name, b interactive)
    Writes name to the static hostname file (see FILES) and updates the transient hostname to match. Passing an empty string removes the static hostname file. Requires the org.freedesktop.hostname1.set-static-hostname PolKit action.

SetPrettyHostname(s name, b interactive)
    Writes name as PRETTY_HOSTNAME in /etc/machine-info, after stripping any trailing dotted domain suffix (see PrettyHostname above). Requires the org.freedesktop.hostname1.set-machine-info PolKit action.

SetIconName(s name, b interactive)
    Writes name as ICON_NAME in /etc/machine-info. Requires org.freedesktop.hostname1.set-machine-info.

SetChassis(s name, b interactive)
    Writes name as CHASSIS in /etc/machine-info. Requires org.freedesktop.hostname1.set-machine-info.

SetDeployment(s name, b interactive)
    Writes name as DEPLOYMENT in /etc/machine-info. Requires org.freedesktop.hostname1.set-machine-info.

SetLocation(s name, b interactive)
    Writes name as LOCATION in /etc/machine-info. Requires org.freedesktop.hostname1.set-machine-info.

GetProductUUID(b interactive) → ay
    Returns the DMI product UUID, read from /sys/class/dmi/id/product_uuid, as a byte array.

GetHardwareSerial(b interactive) → s
    Returns the DMI chassis serial number, read from /sys/class/dmi/id/chassis_serial.

Describe() → s
    Returns a single JSON object containing the current value of every property listed above, for clients that prefer one bulk read over individual property gets. Not used by the bundled hostnamectl(1) client, which reads the underlying files directly instead.

For every method that takes an interactive argument, a value of true indicates the caller is willing to wait for a PolKit authentication dialog to be presented by the user's session PolKit agent; a value of false indicates the call should fail immediately with org.freedesktop.DBus.Error.AuthFailed unless the caller is already authorized.

AUTHORIZATION
Access to the Set* and Get* (UUID/serial) methods over D-Bus is controlled by polkit(8) using the following actions, declared in /usr/share/polkit-1/actions/org.freedesktop.hostname1.policy:

org.freedesktop.hostname1.set-hostname
org.freedesktop.hostname1.set-static-hostname
org.freedesktop.hostname1.set-machine-info

By default these actions require auth_admin for inactive or remote callers and auth_admin_keep for an active local session, matching upstream systemd-hostnamed(8) policy. A PolKit rule installed at /usr/share/polkit-1/rules.d/org.freedesktop.hostname1.rules additionally grants unconditional access to members of the privileged group selected at build time (default `wheel', see the privileged-group meson option), so desktop session tools are not prompted for a password on every edit. Group membership changes only take effect for new login sessions; a user added to the privileged group must log out and back in before hostnamed will recognize the new membership.

These PolKit actions govern D-Bus callers only. The bundled hostnamectl(1) client bypasses D-Bus entirely and writes the underlying files directly, so its own authorization is the ordinary Unix file permissions on those files (in practice, it requires root for every subcommand except status).

FILES

/etc/HOSTNAME
    Default path for the static hostname file (Slackware convention; the build-time HOSTNAME meson option, exposed in code as HOSTNAME_FILE, may point this elsewhere, e.g. /etc/hostname on other distributions). Watched with inotify(7).

/etc/machine-info
    Stores PRETTY_HOSTNAME, ICON_NAME, CHASSIS, DEPLOYMENT, and LOCATION as shell-style KEY="value" assignments. Rewritten atomically (temporary file plus rename) on every write, by either hostnamed itself or hostnamectl(1). Watched with inotify(7).

/etc/os-release
    Read for PRETTY_NAME, CPE_NAME, and HOME_URL. Not written by hostnamed.

/sys/class/dmi/id/chassis_type
/sys/class/dmi/id/chassis_serial
/sys/class/dmi/id/board_vendor
/sys/class/dmi/id/product_name
/sys/class/dmi/id/product_uuid
/sys/class/dmi/id/bios_version
/sys/class/dmi/id/bios_date
    SMBIOS/DMI sysfs nodes read for hardware and firmware identification. Any node that does not exist or cannot be read is treated as empty.

/usr/share/polkit-1/actions/org.freedesktop.hostname1.policy
    PolKit action declarations and default authorization requirements.

/usr/share/polkit-1/rules.d/org.freedesktop.hostname1.rules
    PolKit rule granting the configured privileged group unconditional access to all three hostname1 actions.

SEE ALSO
hostnamectl(1), machine-info(5), os-release(5), polkit(8), pkcheck(1), sethostname(2), inotify(7)

AUTHOR
Nathaniel Russell <naterussell83@gmail.com>

LICENSE
This program is free software, distributed under the GNU General Public License, version 2 or later. See the source for copying conditions.

BUGS
Report bugs at https://github.com/nater1983/hostnamed.