Is there anything in the API for customizing the root password in a Linux vm the same way the Windows admin password can be set?
Unfortunately this is not possible with what is available in Linux prep, Linux/UNIX guestOSes is 2nd to Windows in VMware's world and hopefully this will change sooner than later
What you can do as a work around if you have or plan on installing VMware Tools when the guest is provisioned is to have a default password and then use something like VMware VIX API to change the password or upload a new password hash. It's not ideal but that's as automated as you can get today or by default provision your host with the proper password.
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at:
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Unfortunately this is not possible with what is available in Linux prep, Linux/UNIX guestOSes is 2nd to Windows in VMware's world and hopefully this will change sooner than later
What you can do as a work around if you have or plan on installing VMware Tools when the guest is provisioned is to have a default password and then use something like VMware VIX API to change the password or upload a new password hash. It's not ideal but that's as automated as you can get today or by default provision your host with the proper password.
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at:
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Thanks for the reply. I will look into that.
After almost 3 years is there a better solution provided by vmware?
I need to set the password after the creation of a new vm from a template.
After another 4 years is there a better solution provided by vmware?
2019, no improvement?
Any news? Can only use cloud-init ?
I have used the following Postcustomization script. Which creates a random password sends it password to the guestinfo variable and makes the user reset it upon login.
#!/bin/bash
log=/var/log/cust_output.log
if [[ "x${1}" = "xprecustomization" ]]; then
password=$(openssl rand -base64 12)
echo "root:$password" | chpasswd
vmtoolsd --cmd "info-set guestinfo.custom.password $password"
passwd --expire root
elif [[ "x${1}" = "xpostcustomization" ]]; then
echo "customization complete..." >> ${log}
fi