hostnamectl command is failing with an error "Could not set property: Access denied"
Issue
hostnamectlcommand is failing with the following error.
[root@localhost]# hostnamectl set-hostname test-vm
Could not set property: Access denied
or
[root@localhost]# hostnamectl set-hostname test-vm
Could not set static hostname: Not allowed to update /etc/hostname.
- In
/var/log/messagethe following error messages are found.
Dec 28 04:07:11 localhost systemd-hostnamed: Failed to write static host name: Permission denied
Dec 28 04:07:11 localhost systemd-hostnamed: Failed to write static host name: Permission denied
Environment
- Red Hat Enterprise Linux (RHEL) 7
- Red Hat Enterprise Linux (RHEL) 8
- Red Hat Enterprise Linux (RHEL) 9
- Red Hat Enterprise Linux (RHEL) 10
- Hostnamectl
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.