Resetting password in Linux Mint when disk is encrypted

6,400

This is actually way easier than you might think. Here's how you do it:

  1. Boot into a Live CD.

  2. Decrypt and mount your partition on your hard disk. If you have a couple of partitions that all get mounted at boot, you will need to mount all of those, and in the correct order. Note that while you can get away with it this time, usually this includes bind-mounting /proc and /dev into the hard drive mountpoint.

    I won't go into how to do this, since I forget, but you should be able to find how to online (just search for "mount an encrypted partition linux" or something), or ask a new question here.

  3. If you haven't already opened a terminal, open one, and type chroot /path/to/your/encrypted/drive bash, where /path/to/your/encrypted/drive is where you mounted the hard drive partition.

    chroot stands for "change root". Root here is referring to the root of your directory tree, not the root account. Basically any program that you run from now on will see the hard drive, not the CD, as the root of the filesystem. bash at the end tells chroot what program to run from the new root - so you're running bash from your hard drive, not from the CD. bash will think it's executing from something like /usr/bin/bash, but in reality it'll be executing from /path/to/your/encrypted/drive/usr/bin/bash.

    If my garbled explanation was unreadable, here's the Wikipedia article and the manpage.

  4. Run passwd.

  5. Type exit to get out of the chroot and reboot out of the CD and into your hard drive.

  6. Profit.

Share:
6,400

Related videos on Youtube

NickAldwin
Author by

NickAldwin

Disclaimer: The man in the picture is not intended to represent NickAldwin's actual appearance. Any similarities between Dr. Strangelove and NickAldwin are completely coincidental.

Updated on September 18, 2022

Comments

  • NickAldwin
    NickAldwin over 1 year

    I have a system (VM, actually) with Linux Mint 15 on it. The disk is encrypted, but I remember that password -- just not the password for my account. I've tried changing the command in GRUB from ro to rw init=/bin/bash, per guides online, but that doesn't seem to play nicely with the disk encryption. Is there a way to decrypt the disk, then drop straight to a root prompt (in order to use passwd)?

    • Admin
      Admin over 10 years
      Are you able to boot off a live CD and mount the drive and go through the encryption authentication that way?
    • NickAldwin
      NickAldwin over 10 years
      @50-3 I have a live CD ISO I can run. Can I change the password from there after mounting the drive? If so, how do I do both (mounting and changing password) -- I'm not very familiar.
  • NickAldwin
    NickAldwin over 10 years
    Cool. I'll try this out when I can.
  • dribler
    dribler over 10 years
    Look for cryptsetup luksOpen with the correct options for your drive. You probably also have lvm, so vgchange -ay after the luks volume is mounted since dm-crypt with lvm is the default fde setup for Debian based systems.
  • user
    user over 10 years
    Actually, for point 2, it should be enough to mount just the root file system, since passwd, all the libraries it needs, and /etc/passwd, are all normally squarely within the root file system.
  • user2914606
    user2914606 over 10 years
    Unless you had /etc separated. Or /usr (if you're on Arch Linux), although this configuration is buggy as it is.
  • NickAldwin
    NickAldwin over 10 years
    Sorry for the delay but I must wait for some non-corrupted RAM before I try this. I'll accept it once I can try it.