Skip to main content

Change all CVM/IPMI passwords

  • Sep 14, 2015 11:48 AM UTC
  • 15 replies
  • 9494 views

Forum|alt.badge.img+7
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
This topic has been closed for replies.

15 replies

aluciani
Forum|alt.badge.img+34
  • Chevalier
  • Sep 14, 2015 4:11 PM UTC
Thanks for sharing 

Forum|alt.badge.img+2
  • Nutanix Employee
  • Oct 11, 2016 2:12 PM UTC
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!

mikegelhar
Forum|alt.badge.img+9
  • Trailblazer
  • Oct 17, 2016 12:32 PM UTC
Thanks for sharing this, this was on my to do list and you just saved me a nice chunk of time.

Forum|alt.badge.img
  • Voyager
  • Feb 13, 2017 8:27 PM UTC
Mark,
I'm not familiar with those commands. What scripting language are you running those commands from?

Forum|alt.badge.img+2
  • Nutanix Employee
  • Feb 13, 2017 8:43 PM UTC
Run it from the CVM CLI.

Forum|alt.badge.img
  • Voyager
  • Apr 11, 2017 9:45 PM UTC
Hi
How would you that when one cannot SSH. OR no longer remember the password of the CVM.

Forum|alt.badge.img+17
  • Outrider
  • Apr 12, 2017 6:29 AM UTC
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)

cfrancke
Forum|alt.badge.img+11
  • Adventurer
  • Oct 28, 2017 2:11 PM UTC
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

Forum|alt.badge.img+17
  • Outrider
  • Oct 30, 2017 12:10 AM UTC
cfrancke To change the password for AHV hosts, have you tried running "passwd" command when logged in as root?

cfrancke
Forum|alt.badge.img+11
  • Adventurer
  • Oct 30, 2017 6:15 AM UTC
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

Forum|alt.badge.img+17
  • Outrider
  • Oct 30, 2017 6:35 AM UTC
cfrancke The "passwd" command belongs to Unix system, not Nutanix and you can also run this command on ESXi hosts as well.

Regards,

cfrancke
Forum|alt.badge.img+11
  • Adventurer
  • Oct 30, 2017 6:38 AM UTC
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.

Forum|alt.badge.img+17
  • Outrider
  • Oct 30, 2017 7:03 AM UTC
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,

Forum|alt.badge.img+17
  • Trailblazer
  • Dec 6, 2017 8:37 AM UTC
How to change password for root user of AHV host?

cfrancke
Forum|alt.badge.img+11
  • Adventurer
  • Dec 6, 2017 4:04 PM UTC
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