VMware {code} Community
mm6
Contributor
Contributor
Jump to solution

customization of Linux root password

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?

0 Kudos
1 Solution

Accepted Solutions
lamw
Community Manager
Community Manager
Jump to solution

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 Smiley Sad

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:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

If you find this information useful, please award points for "correct" or "helpful".

View solution in original post

0 Kudos
8 Replies
lamw
Community Manager
Community Manager
Jump to solution

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 Smiley Sad

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:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
mm6
Contributor
Contributor
Jump to solution

Thanks for the reply. I will look into that.

0 Kudos
tasoss
Contributor
Contributor
Jump to solution

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.

0 Kudos
narcissujsk
Contributor
Contributor
Jump to solution

After another   4 years is there a better solution provided by vmware?

0 Kudos
jasper9890
Enthusiast
Enthusiast
Jump to solution

2019, no improvement? Smiley Happy

0 Kudos
Damonysq
Contributor
Contributor
Jump to solution

2022.06.06 no improvement????????????????????????????????????
0 Kudos
JamesCurtis
Contributor
Contributor
Jump to solution

Any news? Can only use cloud-init ?

0 Kudos
jc0326
Contributor
Contributor
Jump to solution

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

0 Kudos