systemd ships with a policykit file which allows the system administrator to set the hostname.
The policykit file is located here: /usr/share/polkit-1/actions/org.freedesktop.hostname1.policy and in the systemd source here: https://github.com/systemd/systemd/blob/master/src/hostname/org.freedesktop.hostname1.policy.in This behaviour is by design. Please file a bug with the upstream systemd project if you believe this should be changed. Thanks. ** Changed in: systemd (Ubuntu) Status: New => Won't Fix -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to systemd in Ubuntu. https://bugs.launchpad.net/bugs/1637030 Title: hostnamectl changes hostname without password Status in systemd package in Ubuntu: Won't Fix Bug description: Systemd's 'hostnamectl' changes the system hostname (including modifying '/etc/hostname') without requesting a password, allowing any unprivileged user to change the system host name. OS: Xubuntu 16.04.1 x64 and Linux Mint 18 Mate x64 Version: systemd 229-4ubuntu11 amd64 I also verified this by performing a fresh unmodified install of Xubuntu 16.04.1, and this behaviour of hostnamectl was present on the first boot. Terminal output: phil@Xubuntu-Development:~$ hostname Xubuntu-Development phil@Xubuntu-Development:~$ cat /etc/hostname Xubuntu-Development phil@Xubuntu-Development:~$ hostnamectl set-hostname Xubuntu-Whatever phil@Xubuntu-Development:~$ hostname Xubuntu-Whatever phil@Xubuntu-Development:~$ cat /etc/hostname Xubuntu-Whatever phil@Xubuntu-Development:~$ hostnamectl set-hostname Xubuntu-Development phil@Xubuntu-Development:~$ hostname Xubuntu-Development phil@Xubuntu-Development:~$ cat /etc/hostname Xubuntu-Development ProblemType: Bug DistroRelease: Ubuntu 16.04 Package: systemd 229-4ubuntu11 Uname: Linux 4.8.1-040801-generic x86_64 NonfreeKernelModules: nvidia_uvm nvidia_drm nvidia_modeset nvidia ApportVersion: 2.20.1-0ubuntu2.1 Architecture: amd64 CurrentDesktop: XFCE Date: Thu Oct 27 10:43:20 2016 InstallationDate: Installed on 2016-08-14 (73 days ago) InstallationMedia: Xubuntu 16.04.1 LTS "Xenial Xerus" - Release amd64 (20160719) MachineType: Gigabyte Technology Co., Ltd. Z97X-SOC Force ProcEnviron: LANGUAGE=en_AU:en PATH=(custom, no user) XDG_RUNTIME_DIR=<set> LANG=en_AU.UTF-8 SHELL=/bin/bash ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-4.8.1-040801-generic root=UUID=4f82359e-10ef-4946-97b5-293bd9a560a6 ro SourcePackage: systemd SystemdDelta: [EXTENDED] /lib/systemd/system/remote-fs.target → /etc/systemd/system/remote-fs.target.d/network.conf [EXTENDED] /lib/systemd/system/rc-local.service → /lib/systemd/system/rc-local.service.d/debian.conf [EXTENDED] /lib/systemd/system/systemd-timesyncd.service → /lib/systemd/system/systemd-timesyncd.service.d/disable-with-time-daemon.conf 3 overridden configuration files found. UpgradeStatus: No upgrade log present (probably fresh install) dmi.bios.date: 04/21/2015 dmi.bios.vendor: American Megatrends Inc. dmi.bios.version: F7 dmi.board.asset.tag: To be filled by O.E.M. dmi.board.name: Z97X-SOC Force dmi.board.vendor: Gigabyte Technology Co., Ltd. dmi.board.version: x.x dmi.chassis.asset.tag: To Be Filled By O.E.M. dmi.chassis.type: 3 dmi.chassis.vendor: Gigabyte Technology Co., Ltd. dmi.chassis.version: To Be Filled By O.E.M. dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvrF7:bd04/21/2015:svnGigabyteTechnologyCo.,Ltd.:pnZ97X-SOCForce:pvrTobefilledbyO.E.M.:rvnGigabyteTechnologyCo.,Ltd.:rnZ97X-SOCForce:rvrx.x:cvnGigabyteTechnologyCo.,Ltd.:ct3:cvrToBeFilledByO.E.M.: dmi.product.name: Z97X-SOC Force dmi.product.version: To be filled by O.E.M. dmi.sys.vendor: Gigabyte Technology Co., Ltd. mtime.conffile..etc.systemd.journald.conf: 2016-08-14T12:19:20.627772 mtime.conffile..etc.systemd.system.conf: 2016-10-03T09:44:26.561968 mtime.conffile..etc.systemd.timesyncd.conf: 2016-10-03T07:52:10.004280 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1637030/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp