Prompt For A New Hostname on Boot

I’ve been brushing up on a few technologies in my home lab, and have found myself using VMware workstation for some simple tasks that don’t require a whole virtualized environment. Workstation didn’t set the hostname of my Ubuntu 18.xx VMs properly after they booted. Maybe I’m a little spoiled by guest OS customization or missing something, but either way, I needed a way to quickly spin up a whole VM and have it’s hostname set correctly. It’s definitely not the cleanest, and I realize I would be better off using the Workstation Pro REST API, but I’m not there yet.

We can do this pretty easily by adding a script to the /etc/profile.d directory. The script I’m currently using is below:

Just modify your parent image, clone your test VMs, and this will prompt you to set a new hostname the first time you log in.

One thought on “Prompt For A New Hostname on Boot

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright © 2024