Change Nutanix Default Passwords

The Nutanix Controller VM (CVM) ‘nutanix’ Account

To change the nutanix default password, SSH to any of the CVM and run the below command to change password, it will replicate to all the CVMs.

nutanix@cvm$ sudo passwd nutanix

The Hypervisor Local Accounts

AHV Hypervisor:
To Change root account password on all Hosts in the cluster, run below command from any of the CVM.

nutanix@cvm$ echo -e “CHANGING ALL AHV HOST ROOT PASSWORDS. Note – This script cannot be used for passwords that contain special characters ( $ \ { } ^ &)\nPlease input new password: “; read -s password1; echo “Confirm new password: “; read -s password2; if [ “$password1” == “$password2” ] && [[ ! “$password1” =~ [\\\{\$\^\}\&] ]]; then hostssh “echo -e \”root:${password1}\” | chpasswd”; else echo “The passwords do not match or contain invalid characters (\ $ { } ^ &)”; fi

To Change admin account password on all Hosts in the cluster, run below command from any of the CVM.

nutanix@cvm$ echo -e “CHANGING ALL AHV HOST ADMIN PASSWORDS. Note – This script cannot be used for passwords that contain special characters ( $ \ { } ^ &)\nPlease input new password: “; read -s password1; echo “Confirm new password: “; read -s password2; if [ “$password1” == “$password2” ] && [[ ! “$password1” =~ [\\\{\$\^\}\&] ]]; then hostssh “echo -e \”admin:${password1}\” | chpasswd”; else echo “The passwords do not match or contain invalid characters (\ $ { } ^ &)”; fi

To Change nutanix account password on all Hosts in the cluster, run below command from any of the CVM.

nutanix@cvm$ echo -e “CHANGING ALL AHV HOST NUTANIX PASSWORDS. Note – This script cannot be used for passwords that contain special characters ( $ \ { } ^ &)\nPlease input new password: “; read -s password1; echo “Confirm new password: “; read -s password2; if [ “$password1” == “$password2” ] && [[ ! “$password1” =~ [\\\{\$\^\}\&] ]]; then hostssh “echo -e \”nutanix:${password1}\” | chpasswd”; else echo “The passwords do not match or contain invalid characters (\ $ { } ^ &)”; fi

VMware ESXi

To Change root account password on all Hosts in the cluster, run below command from any of the CVM.

nutanix@cvm$ echo -e “CHANGING ALL ESXi HOST PASSWORDS. Note – This script cannot be used for passwords that contain special characters ( $ \ { } ^ &)\nPlease input new password: “; read -s password1; echo “Confirm new password: “; read -s password2; if [ “$password1” == “$password2” ] && [[ ! “$password1” =~ [\\\{\$\^\}\&] ]]; then hostssh “echo -e \”${password1}\” | passwd root –stdin”; else echo “The passwords do not match or contain invalid characters (\ $ { } ^ &)”; fi

Microsoft Hyper-V

To change local administrator password for all Hyper-V hypervisors in the Nutanix cluster. Run the below command from any from the CVM.

nutanix@cvm$ echo -e “CHANGING ALL HYPER-V HOST PASSWORDS. Note – This script cannot be used for passwords that contain special characters ( $ \ { } ^)\nPlease input new password: “; read -s password1; echo “Confirm new password: “; read -s password2; if [ “$password1” == “$password2” ] && [[ ! “$password1” =~ [\ \”\’\\\{\$\^\}] ]]; then hostssh “net user administrator $password1”; echo “Updating Host and ManagementServer Entries…”; ncli host ls | grep -i id | grep -Eo “::[0-9]*” | cut -c 3- | while read hID; do ncli host edit id=$hID hypervisor-password=$password1;done > /dev/null; ncli host ls | grep “Hypervisor Address” | awk ‘{print $4}’ | while read hIP; do ncli managementserver edit name=$hIP password=$password1;done > /dev/null; else echo “The passwords do not match or contain invalid characters (\ $ { } ^)”; fi

Leave a comment