Change all CVM/IPMI passwords


Userlevel 2
Badge +7
  • Voyager
  • 2 replies
Hello

I don't know if this will be useful for anyone but I came up with a few command lines to change the default passwords for the CVM and IPMI users and create a new user to mimic the dell DRAC's user

#change IPMI passwordfor i in `hostips`; do ssh root@$i 'for id in `/ipmitool user list |grep 'ADMIN '|cut -d" " -f1`;do echo $id;/ipmitool user set password $id ;done' ; donefor i in `ncli host list | grep -E 'ID ' | cut -d":" -f4`; do ncli host edit id=$i ipmi-password=; done

#create root user on all nodes ipmi to keep consitant with Dell Dracfor i in `hostips`; do ssh root@$i '/ipmitool user set name 3 root;/ipmitool user set password 3 ; /ipmitool user priv 3 4;/ipmitool channel setaccess 1 3 privilege=4;/ipmitool user enable 3' ; done

# change esxi passwordfor i in `hostips`;do echo "--$i--";ssh root@$i 'echo -e "" | passwd';done

#change cvm passwordfor i in `svmips`;do echo "--$i--";ssh nutanix@$i 'echo -e "" | sudo passwd nutanix';done

15 replies

Userlevel 7
Badge +34
Thanks for sharing 
Badge +2
Hi! Super scripts, thanks for sharing.

I just used the IPMI script on a dell XC cluster (ESX6 / AOS 4.7.2) and had to slightly modify the script to the below.

for i in `hostips`; do ssh root@$i 'for id in `/ipmitool user list 1|grep 'root '|cut -d" " -f1`;do echo $id;/ipmitool user set password $id ;done' ; done
for i in `ncli host list | grep -E 'Id ' | cut -d":" -f4`; do ncli host edit id=$i ipmi-password=; done

Thanks!
Badge +9
Thanks for sharing this, this was on my to do list and you just saved me a nice chunk of time.
Badge
Mark,
I'm not familiar with those commands. What scripting language are you running those commands from?
Badge +2
Run it from the CVM CLI.
Badge
Hi
How would you that when one cannot SSH. OR no longer remember the password of the CVM.
Userlevel 1
Badge +16
rajch Do you mean you could not make SSH connections to all CVM because you could not remember the CVM password?

There are 2 ways to connect to CVM, one via host -> 192.168.5.0 network and second is via CVM outside IP Address.

If you could not make it run in both ways, you can leverage the Prism to do that (follow the KB 2233 on Nutanix Portal)
Badge +11
Hi Mark,

the password change for the CVM worked. Whats the possible password complexity? I just created a random one with all kinds of special chars in it but it didn't run.
How can I change the root password for all AHV hosts?

Regards Christian
Userlevel 1
Badge +16
cfrancke To change the password for AHV hosts, have you tried running "passwd" command when logged in as root?
Badge +11
Ok perfect,

that worked. Thanks a lot. Is passwd a nutanix command?

I used a less complex password this time. My "nutanix" user is still locked out on my CVMs. Guess I used a too complex password or chars that are not supported.

Regards Christian
Userlevel 1
Badge +16
cfrancke The "passwd" command belongs to Unix system, not Nutanix and you can also run this command on ESXi hosts as well.

Regards,
Badge +11
Ah ok. Didn't know. I'm really not much into Linux or Unix.
Guess I need to invest more time into that topic if I want to handle Nutanix.

Thanks for your quick reply.

Regards Christian

PS: Do you know the password for the CVM root user or know a way how I can recover my "nutanix" user password?

Update

Ok I just solved it. After reading tons of Linux articles I found this:
https://wiki.centos.org/TipsAndTricks/BecomingRoot

1. Basically I logged in with my PRISM "admin" account
2. I ran: su root - pasword = nutanix/4
3. passwd nutanix

Works 🙂
I tried a couple of times to log in with root and nutanix/4u directly via putty which didn't work but the "su root" command works.
Userlevel 1
Badge +16
cfrancke It depends on your trouble circumtances as it varies from the reason how the you lost the nutanix password and/or the way to connect to Nutanix internals to recover it.
In a case that you lost password in one of CVM in the cluster, you could leverage other CVM to login to it and executed "sudo passwd nutanix" command to assign new password for CVM.
Other way is using Prism to do that (you can search Nutanix Portal/Knowledge Base to find out how to do)

Basically, CVM and AHV are all developed based on CentOS and leverage OpenvSwitch to provide services upfront so it is better off to know a little bit about Linux/Unix or CentOS based command lines. I recommend to have a reference at AHV Best Practice and AHV Networking documents on Nutanix Portal to get deeper into AHV infra.

Regards,


Userlevel 1
Badge +17
How to change password for root user of AHV host?
Badge +11
Hi,

1. Use a tool like putty to connect to your AHV



2. run the command: passwd root
3. Enter your new password
4. Retype your new password


Done

Regards

Christian

Reply