1

I have a dedicated server that i've just setup at Hetzner. I've done the stupid thing of not changing the temp password they give you and disconnected from the SSH session. They don't send nor store this password so it's lost.

I need to reset it.

I'm on a 64-bit Ubuntu install and with a software raid. I reboot into the rescue routine and run the following;

ls /dev/md*

Which displays the 4 partitions of md0, md1, md2, md3

I then mount the boot drive with mount /dev/md2 /mnt. I prepare and try to switch into chroot with the following commands.

chroot-prepare /mnt
chroot /mnt

With the last command i get the output of: mkdir: cannot create directory ‘/mnt/run/lock’: File exists

I then change the password with passwd root. This all accepts the commands, i reboot and the password still doesn't work.

  • rightliy or wrongly i deleted the lock directory in the rescue image, this allowed the commands to run cleanly. Once again, after reboot i still can't get in – Nathan Jun 4 '19 at 18:37
  • At this point, it's likely faster to just reinstall the whole server again... – Sven Jun 4 '19 at 19:31
  • 1
    Did you try to edit a boot command? reboot Ubuntu, then press E to edit the boot parameters, find the line starting with "linux" and append *rw init=/bin/bash" at the end of line. And press Ctrl + X to boot. Now type passwd root, and reboot. Your new password should work. – tien Jun 5 '19 at 10:34
  • At this point i do not have access to boot into grub. i can only initiate a reboot into their rescue runtime via their web control panel. – Nathan Jun 6 '19 at 9:42
  • Is there a way to do it via config files as i can get access to the drive and make changes – Nathan Jun 6 '19 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.