I want to update the hostname for one of my VMware virtual machines running SUSE Linux Enterprise Server 11 SP3 for VMware .

I tried changing the hostname using YaST but after reboot the old name came back.

I tried echo "newhostname > /etc/HOSTNAME" but after reboot this also goes.

I also tried hostname newhostname but this was also lost after reboot.

How can I make the change permanent?

  • In yast, uncheck the change hostname via DHCP tick box Commented Jul 27, 2015 at 6:13
  • It is already Unchecked change hostname via DHCP │[ ] Change Hostname via DHCPNo interface with dhcp
    – syed
    Commented Jul 28, 2015 at 11:34
  • Does your virtual machine use DHCP? How are you checking the hostname - via the hostname command?
    – mjturner
    Commented Jul 28, 2015 at 12:13
  • No, This machine is having static IP. Yes host name command shows me my hostname as myworkspace after reboot. Even kernel shows new name before reboot, but after reboot revert to old name. myworkspace:/ # more /proc/sys/kernel/hostname go
    – syed
    Commented Jul 29, 2015 at 13:23
  • 1
    In SLES_11 hostname is in /proc/sys/kernel/hostname ;) Commented Apr 13, 2017 at 12:01

4 Answers 4


To change the hostname on a SUSE system you need to change the following files:

  • /etc/HOSTNAME
  • /etc/hosts

You may also have other configuration files where it's stored (e.g., postfix configuration files), so a grep -R for the old hostname in /etc is probably a good idea:

grep -R <oldhostname> /etc

where <oldhostname> is the old hostname).

  • no files shows where its reflecting to old hostname in /etc after doing the changes. But after reboot again old hostname shows:
    – syed
    Commented Jul 28, 2015 at 11:35
  • After reboot old hostname shows Before Change myworkspace:~ # grep -R myworkspace /etc /etc/hosts.YaST2save: myworkspace.kaec.net myworkspace /etc/sysconfig/elasticsearch:ES_UNICAST_HOSTS=myworkspace.kaec.net /etc/hosts.orig: myworkspace.kaec.net myworkspace Binary file /etc/krb5.keytab matches Binary file /etc/ssh/ssh_host_key matches /etc/HOSTNAME:myworkspace.kaec.net After Chnage myworkspace:~ # grep -R myworkspace /etc /etc/sysconfig/elasticsearch:ES_UNICAST_HOSTS=myworkspace.kaec.net Binary file /etc/krb5.keytab matches Binary file /etc/ssh/ssh_host_key matches
    – syed
    Commented Jul 28, 2015 at 11:44

Just use the hostnamectl set-hostname (hostname) command. Do not include the brackets that is a placeholder for the hostname. Then restart your terminal for it to take effect.


I'd like to point out that the more standard file is /etc/hostname. SuSE uses a symlink to point /etc/HOSTNAME to this file, so a script which wrote to /etc/hostname (perhaps because it was designed to run in multiplpe distributions of Linux/Unix) would work if it wrote to /etc/hostname.


I noticed even yast doesn't set the hostname when I used lowercase chars for the hostname part. Uppercase chars worked.

To up the chances, also did a /etc/init.d/network restart, followed by a logout/login.

Try this to help your script. I've already lost an hour setting the hostname, so I didn't test setting the files manually.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .