# Changing the hostname

**URL:** <https://forums.suse.com/t/changing-the-hostname/566>\
**Category:** RancherOS\
**Created:** [September 25, 2015, 10:03pm UTC](https://forums.suse.com/t/changing-the-hostname/566 "2015-09-25T22:03:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![erichorne](https://avatars.discourse-cdn.com/v4/letter/e/e19adc/32.png) [@erichorne](https://forums.suse.com/u/erichorne)\
**Post date:** [September 25, 2015, 10:03pm UTC](https://forums.suse.com/t/changing-the-hostname/566/1 "2015-09-25T22:03:26Z")

</div>

I made a mistake. I didn’t define the hostname in the cloud-config. Now I have this system just how I want it except the hostname.

I didn’t see a ‘ros config set’ variable for hostname, and setting ‘hostname’ to a value doesn’t seem to do anything. Changing the /etc/hostname and /etc/hosts file also doesn’t survive a reboot. Reinstalling rancheros from my thumbdrive doesn’t seem possible/easy because the thumbdrive mounts the persistent disk (rancheros-install fails because the device is busy, so I can’t reapply the cloud-config with a hostname attribute).

Thoughts on how to hack this host up to give it a hostname?

---

<div class="post-metadata">

**Author:** ![denise](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@denise](https://forums.suse.com/u/denise)\
**Post date:** [September 28, 2015, 3:43am UTC](https://forums.suse.com/t/changing-the-hostname/566/2 "2015-09-28T03:43:36Z")

</div>

Unfortunately, I don’t have any great ideas on how to hack it up on v0.3.3 but in v0.4.0 the `ros config` will allow you to set the hostname as you’ll be editing an entire cloud config versus just hte `rancher` portion of the cloud config.

---

<div class="post-metadata">

**Author:** ![erichorne](https://avatars.discourse-cdn.com/v4/letter/e/e19adc/32.png) [@erichorne](https://forums.suse.com/u/erichorne)\
**Post date:** [September 28, 2015, 5:22pm UTC](https://forums.suse.com/t/changing-the-hostname/566/3 "2015-09-28T17:22:09Z")

</div>

Thanks. The best idea I could come up with was a startup script that ran hostname and then replaced 127.0.1.1 in /etc/hosts with the preferred name. As you said, though – not a great idea 🙂

I’ll be looking to upgrade to 0.4.0 when it’s released!

-Eric

---

<div class="post-metadata">

**Author:** ![ashmckenzie](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/ashmckenzie/32/1371_2.png) [@ashmckenzie](https://forums.suse.com/u/ashmckenzie)\
**Post date:** [May 27, 2016, 2:22am UTC](https://forums.suse.com/t/changing-the-hostname/566/5 "2016-05-27T02:22:14Z")

</div>

The following worked for me on RancherOS v0.4.5 - `ros config set hostname <hostname>`
