This article describes how to recover root password in vSRX within kernel-based virtual machine (KVM) environment.
Steps to recover the root password in KVM environment:
Reboot the vSRX instance using virsh utility: virsh reboot {domain-id or domain-name}
virsh reboot {domain-id or domain-name}
Immediately try login to the same instance using domain-name because domain-id may change after the reboot : virsh console domain-name
virsh console domain-name
After login, you will see a prompt like Escape character is ^] . Press enter a couple of times and you will see the boot process.
Escape character is ^]
Let it boot until wind river Linux and the time you see the following prompt:
Hit [Enter] to boot immediately, or space bar for command prompt. Booting [kernel] in 9 seconds...
Press the space bar and break to boot sequence. Then type boot -s to login to single user mode:
At the following prompt, type recovery to start the root password recovery procedure.
Enter full pathname of shell or 'recovery' for root password recovery or RETURN for /bin/sh: recovery
Once this script ends, you will be in vSRX operational mode.
Change to configuration mode using edit or config command.
edit or config
Set a new password as : set system root-authentication plain-text-password
set system root-authentication plain-text-password
New password: <-- Configure password here and confirm in next step.
New password: <--
Commit the change and enter: commit
commit
Exit from config mode and reboot the vSRX: #exit > request system reboot Reboot the system? [y/n] y
#exit > request system reboot Reboot the system? [y/n] y
Now, you should be able to login with the new password.