Home > Linux > Ubuntu recover root password

Ubuntu recover root password

Today i locked myself out of Ubuntu 11.10 with a stupid typo

The Mistake:

  1. Single user mode: i am the only system user and i and the admin
  2. Wanted to add myself to the vbox group
  3. My supplementary groups were “admin” which is the Ubuntu default for superusers
  4. typed the command usermod -G vboxsf naveen ( missed the -a Flag )
  5. The correct command must have been  usermod -aG vboxsf naveen (the -a appends )
  6. Without the -a flag, my supplementary group got overwritten as vboxsf – and now i dont have admin privileges – duh!!

The recovery:

  1. Reboot into Ubuntu
  2. Press and Hold the “Shift” button to access the GRUB
  3. From the GRUB select Recover Mode
  4. You should see a window with 4 options (resume, fsck, remount, root)
  5. Select remount – it will remount the file system as read write
  6. The file system during recovery mode will typically be mounted as read-only – so you cannot modify anything if you dont do the above step
  7. Next select root: Drop to root shell prompt, it will drop you into the root command prompt
  8. Now you are root and can do anything
  9. I fixed my error with usermod -aG admin naveen ( no typos this time ! )
  10. Exit-Reboot and you are fine !!
Categories: Linux
  1. Sridhar
    July 16, 2012 at 3:38 AM

    I am using Ubuntu 11.10 in VMWare, how can i reboot the system…

    • July 17, 2012 at 5:28 PM

      Sridhar, i did not understand your question. Have you already booted into the system and trying to reboot – or have you lost the root password and trying to boot. In either case all you need to do is to start the guest OS in VMWare and it should show you the boot screen

  2. Sridhar
    August 14, 2012 at 11:39 AM

    Thank you for your reply. I would like to know how to change root password in Ubuntu. I got the error as “sudo setuid must be root”. how can i solve this error?

    • August 14, 2012 at 3:03 PM

      Did you do some permission changes to the sudo file or the /usr directory ? – run the below command and you should see almost the same permissions as i see for your sudo file located at /usr/bin/sudo

      naveen@naveen-VirtualBox:/usr/bin$ ls -la /usr/bin/sudo
      -rwsr-xr-x 2 root root 69708 May 31 23:53 /usr/bin/sudo

      are your file permissions correct ?

  3. Prasanna
    August 14, 2012 at 11:50 AM

    I am using Ubuntu10.04. There is no option “remount” in recovery mode. How can do further process? How to change root password on recovery mode?

  4. September 3, 2014 at 3:46 PM

    On latest Ubuntu choose network before dropping into root shell… This enables RW filesystem like the remount described.

  5. April 27, 2015 at 5:41 PM

    Hi,I tried resetting my password using the steps you have suggested.After i choose recovery mode from GRUB,it takes me to a screen where it says loading disk and its stuck there.Doesnt give menu with the options remount/root etc.Please help

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: