I have a virtual Ubuntu 10.04 machine running under Hyper-V which I have lost the password to. With a physical Ubuntu box it's rather easy to press ESC at the grub prompt and proceed to reset your password. Unfortunately I can't see a grub menu and pressing ESC does nothing. Can anyone offer some advice for how to reset the password on this virtual machine?

link|improve this question

73% accept rate
1  
The fact that it's a virtual machine makes no difference. ESC works just the same when you have the console window up; perhaps pushing it rapidly would work, I don't think the Hyper-V BIOS passes any key presses during BIOS initialization. – Chris S Jul 28 '10 at 12:24
While I agree that it makes no difference that it's a VM, Hyper-V not passing keypresses during bios init. is definitely a huge problem and it appears that this is the case. – JohnyD Jul 28 '10 at 12:42
feedback

1 Answer

Use a boot cd! - mount your root partition to /mnt/root/ - change /etc/shadow to root::[and so on] - OR type: "chroot /mnt/root passwd" - reboot, login with empty password or the new one you specified

link|improve this answer
Could you explain those steps a little more? How do I mount my root partition to /mnt/root/? By boot cd I assume you mean an Ubuntu 10.04 cd? – JohnyD Jul 28 '10 at 12:47
Use a grml or gentoo boot (aka "Live)-CD. I don't know your partition layout, so try: mount /dev/sda /mnt/root – Craig Jul 28 '10 at 13:27
Ok, I've booted my GRML live cd. I create a directory 'root' in /mnt/. I successfully 'mount /dev/sda1 /mnt/root'. After this I: 'nano /etc/shadow' and can see my account name and the hashed password within it. I remove everything between the ::'s. When I reboot as soon as I press enter on my username it says 'Authentication Failure', it does not even ask for a password. I restored my vhd and tried again, this time placing an '!' in /etc/shadow for my user account which should be interpreted as NULL or blank... – JohnyD Jul 28 '10 at 14:52
...This time when I rebooted it allowed me to enter a password but it gave me an Authentication Failure when I tried a blank pass. Also, 'chroot /mnt/root pass' gave me an error because pass is not a command. I used passwd and it gives me, "Authentication token manipulation error. Password unchanged." Any suggestions? – JohnyD Jul 28 '10 at 14:52
1  
Typo! Try chroot /mnt/root passwd – Craig Jul 30 '10 at 20:43
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.