From cec95aa2559fc095e4351e5dc69f2268f6350651 Mon Sep 17 00:00:00 2001 From: Ben Burwell Date: Mon, 17 Sep 2018 22:12:24 -0400 Subject: General cleanup --- ...tten-password-on-luks-encrypted-ubuntu.markdown | 38 ---------------------- 1 file changed, 38 deletions(-) delete mode 100644 _posts/2015-03-28-reset-forgotten-password-on-luks-encrypted-ubuntu.markdown (limited to '_posts/2015-03-28-reset-forgotten-password-on-luks-encrypted-ubuntu.markdown') diff --git a/_posts/2015-03-28-reset-forgotten-password-on-luks-encrypted-ubuntu.markdown b/_posts/2015-03-28-reset-forgotten-password-on-luks-encrypted-ubuntu.markdown deleted file mode 100644 index b3154df..0000000 --- a/_posts/2015-03-28-reset-forgotten-password-on-luks-encrypted-ubuntu.markdown +++ /dev/null @@ -1,38 +0,0 @@ ---- -title: How to Reset a Lost Password on a LUKS-Encrypted Disk in Ubuntu Linux -description: I recently needed to reset a lost password on an Ubuntu installation. But the LUKS encryption on the disk gave me some challenges. Here's what I did. -layout: post -category: writing -date: 2015-03-28 00:00:00 ---- - -Here's the situation I recently found myself in: - -* Ubuntu Linux 14.10 -* Unknown password for user account -* Unknown (but set) root password (Ubuntu's philosophy is to use `sudo` for everything) -* LUKS encrypted filesystem (known passphrase) -* Physical access to the computer - - - -I needed to reset my account password. Normally, with physical access to a machine, all bets are off when it comes to security. I tried booting up the machine into [recovery mode](https://wiki.ubuntu.com/RecoveryMode) by holding down shift as soon as the BIOS had finished loading. But when I selected the "Drop to root shell" option, I was prompted to enter the unknown root password. - -My second approach was to boot into single user mode by editing the GRUB command script. - -
Ubuntu's GRUB menu
- -By going down to the recovery mode option and hitting e, you can edit the GRUB commands. By adding init=/bin/bash at the end of the line beginning with linux that specifies the boot image, you can specify an initial shell to use. Then I hit F10 to boot. - -After waiting for about 30 seconds or a minute, I saw a message that waiting for the root device (the locked disk) had timed out. I was then dumped into an [initramfs](https://wiki.ubuntu.com/Initramfs) shell. From there, I was able to unlock the disk by running cryptsetup luksOpen /dev/sda3 sda3_crypt. - -Next, I mounted the freshly-unlocked disk with mount -o rw /dev/sda3 /root, taking advantage of the pre-existing empty directory. From there, I used chroot to run passwd in the OS. - -{% highlight bash %} -$ chroot /root passwd -$ chroot /root passwd myUserName -{% endhighlight %} - -By running these commands, I successfully reset both the root password as well as the password for my account. From there, I was able to restart the machine and boot normally. - -*Is something here incorrect? Know of a better way to do it? Let me know [@bburwell](https://twitter.com/bburwell).* -- cgit v1.2.3