I can't log in to my root user's account. I've looked for a solution, but all of them tell you to do it from the boot options.

The thing is that my laptop's screen has turned black and it doesn't work anymore, so I've connected another monitor to the laptop so I can work on my computer, but I won't be able to see the boot menu on my new monitor.

Is it possible to change my password without using the boot menu?

Thank you!

  • There is grub-reboot that allows you to specify the entry you want to boot next time from within your running Ubuntu session. But if you have no working admin account, your only way is to reboot into recovery mode and drop to a root shell, AFAIK. I could be wrong though, maybe somebody has an idea. – Byte Commander Oct 1 '16 at 12:23
  • @ByteCommander: grub-reboot requires super-user privileges. If OP had those she could reset any account password she wanted. – David Foerster Oct 1 '16 at 12:38
  • Oh, right. Forgot that :-/ – Byte Commander Oct 1 '16 at 13:01

No, that's not possible as that would defeat the purpose of a password-protected super-user account.

Boot recovery mode blindly

I recommend that you first try to boot to recover mode “blindly”, i. e. try to open the Grub menu and selecting the boot entry for recovery mode without actually seeing what you're doing. It may a few tries, maybe 10 or 20 until you find the right key sequence and timings. The secondary screen is going to start to work during the boot process probably. See How do I reset a lost administrative password? for general instructions and refer to this answer for the current structure of the Grub menu to reach the recovery mode entry.

The key sequence should be:

  1. Shift at the right time to cancel the countdown for the default boot option and to show the Grub menu (if it's configured to not show without user interaction).

  2. (downwards arrow key) and Enter to select “Advanced options for Ubuntu.”

  3. In the sub-menu, (downwards arrow key) and Enter again to select “recovery mode.”

Reset password from Live DVD/USB

If you can't find the right key sequence or timings or the image doesn't show up on the secondary screen, you can reset the password from a live system.

  1. Create a Live DVD/USB (if you don't have one ready) and boot it as if you wanted to install Ubuntu.

  2. Choose the “Try Ubuntu” option in the boot menu.

  3. Open a terminal (Ctrl+Alt+T).

  4. Identify the device path of the partition of your Ubuntu installation. You can use (among other)

    • the graphical Gnome Disks application (sample screenshot) or

    • the terminal command:


    You can recognise the right partition through properties like the size, the label (if you set one), and the file system type (“ext4” in a default installation).

    For the sake of simplicity let's assume that your Ubuntu installation is on the device with the path /dev/sda5.

  5. Mount the identified partition:

    • Gnome Disks has a “mount” button. In recent versions it looks like the playback symbol (▶) which is replaced by the stop symbol (■) when a file system is in mounted state.

    • On the terminal:

      udisksctl mount --block-device /dev/sda5

    On success both will show you the mountpoint, i. e. the path where the file system content is made available. Let's assume it's /media/my-ubuntu-installation.

  6. On the terminal run

    sudo passwd --root /media/my-ubuntu-installation <USERNAME>

    where you replace <USERNAME> with the name of your user account. Enter a new password when asked (twice).

  7. Reboot normally and you should be able to log in with that password and authenticate as super-user with sudo and friends.

| improve this answer | |
  • Doesn't this mean that basically anybody with a live CD can get into anybody else's linux computer, and change their password? – Nonny Moose Oct 1 '16 at 15:17
  • @NonnyMoose: Yes. More generally everybody with physical access to a computer can do whatever they want with its operating system and data (given enough time). The only things you can protect are the secrecy and and integrity of the two if you use encryption and “integrity” only means that manipulation is always detectable, not that manipulation is impossible. – David Foerster Oct 1 '16 at 15:51
  • For that assertion to be true, one also needs to assume that the system firmware cannot be manipulated without authorization (which is not usually the case unfortunately). – David Foerster Oct 1 '16 at 16:03

Your Answer

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

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