{
    "content": [
        {
            "type": "text",
            "text": "# ORG.FREEDESKTOP.HOSTNAME1 (info)\n\n## NAME\n\norg.freedesktop.hostname1 - The D-Bus interface of systemd-hostnamed\n\n## Sections\n\n- **NAME**\n- **INTRODUCTION**\n- **THE D-BUS API**\n- **SEMANTICS**\n- **RECOMMENDATIONS**\n- **VERSIONING**\n- **EXAMPLES**\n- **SEE ALSO**\n- **NOTES**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "ORG.FREEDESKTOP.HOSTNAME1",
        "section": "",
        "mode": "info",
        "summary": "org.freedesktop.hostname1 - The D-Bus interface of systemd-hostnamed",
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [
            "Example 1. Introspect org.freedesktop.hostname1 on the bus",
            "$ gdbus introspect --system \\",
            "--dest org.freedesktop.hostname1 \\",
            "--object-path /org/freedesktop/hostname1"
        ],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "INTRODUCTION",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "THE D-BUS API",
                "lines": 59,
                "subsections": []
            },
            {
                "name": "SEMANTICS",
                "lines": 122,
                "subsections": []
            },
            {
                "name": "RECOMMENDATIONS",
                "lines": 73,
                "subsections": []
            },
            {
                "name": "VERSIONING",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "NOTES",
                "lines": 10,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "org.freedesktop.hostname1 - The D-Bus interface of systemd-hostnamed\n",
                "subsections": []
            },
            "INTRODUCTION": {
                "content": "systemd-hostnamed.service(8) is a system service that can be used to\ncontrol the hostname and related machine metadata from user programs.\nThis page describes the hostname semantics and the D-Bus interface.\n",
                "subsections": []
            },
            "THE D-BUS API": {
                "content": "The service exposes the following interfaces on the bus:\n\nnode /org/freedesktop/hostname1 {\ninterface org.freedesktop.hostname1 {\nmethods:\nSetHostname(in  s hostname,\nin  b interactive);\nSetStaticHostname(in  s hostname,\nin  b interactive);\nSetPrettyHostname(in  s hostname,\nin  b interactive);\nSetIconName(in  s icon,\nin  b interactive);\nSetChassis(in  s chassis,\nin  b interactive);\nSetDeployment(in  s deployment,\nin  b interactive);\nSetLocation(in  s location,\nin  b interactive);\nGetProductUUID(in  b interactive,\nout ay uuid);\nDescribe(out s json);\nproperties:\nreadonly s Hostname = '...';\nreadonly s StaticHostname = '...';\nreadonly s PrettyHostname = '...';\n@org.freedesktop.DBus.Property.EmitsChangedSignal(\"const\")\nreadonly s DefaultHostname = '...';\nreadonly s HostnameSource = '...';\nreadonly s IconName = '...';\nreadonly s Chassis = '...';\nreadonly s Deployment = '...';\nreadonly s Location = '...';\n@org.freedesktop.DBus.Property.EmitsChangedSignal(\"const\")\nreadonly s KernelName = '...';\n@org.freedesktop.DBus.Property.EmitsChangedSignal(\"const\")\nreadonly s KernelRelease = '...';\n@org.freedesktop.DBus.Property.EmitsChangedSignal(\"const\")\nreadonly s KernelVersion = '...';\n@org.freedesktop.DBus.Property.EmitsChangedSignal(\"const\")\nreadonly s OperatingSystemPrettyName = '...';\n@org.freedesktop.DBus.Property.EmitsChangedSignal(\"const\")\nreadonly s OperatingSystemCPEName = '...';\n@org.freedesktop.DBus.Property.EmitsChangedSignal(\"const\")\nreadonly s HomeURL = '...';\n@org.freedesktop.DBus.Property.EmitsChangedSignal(\"const\")\nreadonly s HardwareVendor = '...';\n@org.freedesktop.DBus.Property.EmitsChangedSignal(\"const\")\nreadonly s HardwareModel = '...';\n};\ninterface org.freedesktop.DBus.Peer { ... };\ninterface org.freedesktop.DBus.Introspectable { ... };\ninterface org.freedesktop.DBus.Properties { ... };\n};\n\nWhenever the hostname or other metadata is changed via the daemon,\nPropertyChanged signals are sent out to subscribed clients. Changing a\nhostname using this interface is authenticated via polkit[1].\n",
                "subsections": []
            },
            "SEMANTICS": {
                "content": "The StaticHostname property exposes the \"static\" hostname configured in\n/etc/hostname. It is not always in sync with the current hostname as\nreturned by the gethostname(3) system call. If no static hostname is\nconfigured this property will be the empty string.\n\nWhen systemd(1) or systemd-hostnamed.service(8) set the hostname, this\nstatic hostname has the highest priority.\n\nThe Hostname property exposes the actual hostname configured in the\nkernel via sethostname(3). It can be different from the static\nhostname. This property is never empty.\n\nThe PrettyHostname property exposes the pretty hostname which is a\nfree-form UTF-8 hostname for presentation to the user. User interfaces\nshould ensure that the pretty hostname and the static hostname stay in\nsync. E.g. when the former is \"Lennart's Computer\" the latter should be\n\"lennarts-computer\". If no pretty hostname is set this setting will be\nthe empty string. Applications should then find a suitable fallback,\nsuch as the dynamic hostname.\n\nThe DefaultHostname property exposes the default hostname (configured\nthrough os-release(5), or a fallback set at compilation time).\n\nThe HostnameSource property exposes the origin of the currently\nconfigured hostname. One of \"static\" (set from /etc/hostname),\n\"transient\" (a non-permanent hostname from an external source),\n\"default\" (the value from os-release or the compiled-in fallback).\n\nThe IconName property exposes the icon name following the XDG icon\nnaming spec. If not set, information such as the chassis type (see\nbelow) is used to find a suitable fallback icon name (i.e.\n\"computer-laptop\" vs.  \"computer-desktop\" is picked based on the\nchassis information). If no such data is available, the empty string is\nreturned. In that case an application should fall back to a replacement\nicon, for example \"computer\". If this property is set to the empty\nstring, the automatic fallback name selection is enabled again.\n\nThe Chassis property exposes a chassis type, one of the currently\ndefined chassis types: \"desktop\", \"laptop\", \"server\", \"tablet\",\n\"handset\", as well as the special chassis types \"vm\" and \"container\"\nfor virtualized systems. Note that in most cases the chassis type will\nbe determined automatically from DMI/SMBIOS/ACPI firmware information.\nWriting to this setting is hence useful only to override misdetected\nchassis types, or to configure the chassis type if it could not be\nauto-detected. Set this property to the empty string to reenable the\nautomatic detection of the chassis type from firmware information.\n\nNote that systemd-hostnamed starts only on request and terminates after\na short idle period. This effectively means that PropertyChanged\nmessages are not sent out for changes made directly on the files (as\nin: administrator edits the files with vi). This is the intended\nbehavior: manual configuration changes should require manual reloading.\n\nThe transient (dynamic) hostname exposed by the Hostname property maps\ndirectly to the kernel hostname. This hostname should be assumed to be\nhighly dynamic, and hence should be watched directly, without depending\non PropertyChanged messages from systemd-hostnamed. To accomplish this,\nopen /proc/sys/kernel/hostname and poll(3) for SIGHUP which is\ntriggered by the kernel every time the hostname changes. Again: this is\nspecial for the transient (dynamic) hostname, and does not apply to the\nconfigured (fixed) hostname.\n\nApplications may read the hostname data directly if hostname change\nnotifications are not necessary. Use gethostname(3), /etc/hostname\n(possibly with per-distribution fallbacks), and machine-info(3) for\nthat. For more information on these files and syscalls see the\nrespective man pages.\n\nKernelName, KernelRelease, and KernelVersion expose the kernel name\n(e.g.  \"Linux\"), release (e.g.  \"5.0.0-11\"), and version (i.e. the\nbuild number, e.g.  \"#11\") as reported by uname(2).\nOperatingSystemPrettyName, OperatingSystemCPEName, and HomeURL expose\nthe PRETTYNAME=, CPENAME= and HOMEURL= fields from os-release(5).\nThe purpose of those properties is to allow remote clients to access\nthis information over D-Bus. Local clients can access the information\ndirectly.\n\nMethods\nSetHostname() sets the transient (dynamic) hostname, which is used if\nno static hostname is set. This value must be an internet-style\nhostname, 7-bit lowercase ASCII, no special chars/spaces. An empty\nstring will unset the transient hostname.\n\nSetStaticHostname() sets the static hostname which is exposed by the\nStaticHostname property. When called with an empty argument, the static\nconfiguration in /etc/hostname is removed. Since the static hostname\nhas the highest priority, calling this function usually affects also\nthe Hostname property and the effective hostname configured in the\nkernel.\n\nSetPrettyHostname() sets the pretty hostname which is exposed by the\nPrettyHostname property.\n\nSetIconName(), SetChassis(), SetDeployment(), and SetLocation() set the\nproperties IconName (the name of the icon representing for the\nmachine), Chassis (the machine form factor), Deployment (the system\ndeployment environment), and Location (physical system location),\nrespectively.\n\nPrettyHostname, IconName, Chassis, Deployment, and Location are stored\nin /etc/machine-info. See machine-info(5) for the semantics of those\nsettings.\n\nGetProductUUID() returns the \"product UUID\" as exposed by the kernel\nbased on DMI information in /sys/class/dmi/id/productuuid. Reading the\nfile directly requires root privileges, and this method allows access\nto unprivileged clients through the polkit framework.\n\nDescribe() returns a JSON representation of all properties in one.\n\nSecurity\nThe interactive boolean parameters can be used to control whether\npolkit should interactively ask the user for authentication credentials\nif required.\n\nThe polkit action for SetHostname() is\norg.freedesktop.hostname1.set-hostname. For SetStaticHostname() and\nSetPrettyHostname() it is\norg.freedesktop.hostname1.set-static-hostname. For SetIconName(),\nSetChassis(), SetDeployment() and SetLocation() it is\norg.freedesktop.hostname1.set-machine-info.\n",
                "subsections": []
            },
            "RECOMMENDATIONS": {
                "content": "Here are three examples that show how the pretty hostname and the icon\nname should be used:\n\no   When registering DNS-SD services: use the pretty hostname in the\nservice name, and pass the icon name in the TXT data, if there is\nan icon name. Browsing clients can then show the server icon on\neach service. This is especially useful for WebDAV applications or\nUPnP media sharing.\n\no   Set the bluetooth name to the pretty hostname.\n\no   When your file browser has a \"Computer\" icon, replace the name with\nthe pretty hostname if set, and the icon with the icon name, if it\nis set.\n\nTo properly handle name lookups with changing local hostnames without\nhaving to edit /etc/hosts, we recommend using systemd-hostnamed in\ncombination with nss-myhostname(3).\n\nHere are some recommendations to follow when generating a static\n(internet) hostname from a pretty name:\n\no   Generate a single DNS label only, not an FQDN. That means no dots\nallowed. Strip them, or replace them with \"-\".\n\no   It's probably safer to not use any non-ASCII chars, even if DNS\nallows this in some way these days. In fact, restrict your charset\nto \"a-zA-Z0-9\" and \"-\". Strip other chars, or try to replace them\nin some smart way with chars from this set, for example \"a\" ->\n\"ae\", and use \"-\" as the replacement for all punctuation characters\nand whitespace.\n\no   Try to avoid creating repeated \"-\", as well as \"-\" as the first or\nlast char.\n\no   Limit the hostname to 63 chars, which is the length of a DNS label.\n\no   If after stripping special chars the empty string is the result,\nyou can pass this as-is to systemd-hostnamed in which case it will\nautomatically use a suitable fallback.\n\no   Uppercase charaacters should be replaced with their lowercase\nequivalents.\n\nNote that while systemd-hostnamed applies some checks to the hostname\nyou pass they are much looser than the recommendations above. For\nexample, systemd-hostnamed will also accept \"\" in the hostname, but we\nrecommend not using this to avoid clashes with DNS-SD service types.\nAlso systemd-hostnamed allows longer hostnames, but because of the DNS\nlabel limitations, we recommend not making use of this.\n\nHere are a couple of example conversions:\n\no   \"Lennart's PC\" -> \"lennarts-pc\"\n\no   \"Mullers Computer\" -> \"muellers-computer\"\n\no   \"Voran!\"  -> \"voran\"\n\no   \"Es war einmal ein Mannlein\" -> \"es-war-einmal-ein-maennlein\"\n\no   \"Jawoll. Ist doch wahr!\"  -> \"jawoll-ist-doch-wahr\"\n\no   \"\" -> \"localhost\"\n\no   \"...zack!!! zack!...\"  -> \"zack-zack\"\n\nOf course, an already valid internet hostname label you enter and pass\nthrough this conversion should stay unmodified, so that users have\ndirect control of it, if they want -- by simply ignoring the fact that\nthe pretty hostname is pretty and just edit it as if it was the normal\ninternet name.\n",
                "subsections": []
            },
            "VERSIONING": {
                "content": "These D-Bus interfaces follow the usual interface versioning\nguidelines[2].\n",
                "subsections": []
            },
            "EXAMPLES": {
                "content": "Example 1. Introspect org.freedesktop.hostname1 on the bus\n\n$ gdbus introspect --system \\\n--dest org.freedesktop.hostname1 \\\n--object-path /org/freedesktop/hostname1\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "David Zeuthen's original Fedora Feature page about xdg-hostname[3]\n",
                "subsections": []
            },
            "NOTES": {
                "content": "1. polkit\nhttps://www.freedesktop.org/software/polkit/docs/latest/\n\n2. the usual interface versioning guidelines\nhttp://0pointer.de/blog/projects/versioning-dbus.html\n\n3. Feature page about xdg-hostname\nhttps://fedoraproject.org/wiki/Features/BetterHostname\n\nsystemd 249                                       ORG.FREEDESKTOP.HOSTNAME1(5)",
                "subsections": []
            }
        }
    }
}