LinuxUbuntu 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

Comments

  1. April 27, 2015 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. April 27, 2015 5:48 pm

      @Priyanka Yadav you did not mention what happened that you are trying to reset your root password - is root the only account with root privileges ? of you have another account with root privileges, then use that. If yor are not able to proceed further with the OS on your machine, try using a live cd to reset the password http://www.howtogeek.com/howto/linux/reset-your-ubuntu-password-easily-from-the-live-cd/
  2. September 3, 2014 3:46 pm

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

    August 14, 2012 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?
    1. August 14, 2012 3:07 pm

      this might help http://ubuntu-for-humans.blogspot.com/2010/11/how-to-reset-administrator-password-in.html
  4. Sridhar

    August 14, 2012 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?
    1. August 14, 2012 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 ?
  5. Sridhar

    July 16, 2012 3:38 am

    I am using Ubuntu 11.10 in VMWare, how can i reboot the system...
    1. July 17, 2012 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

Post a comment

Your email address will not be published. Required fields are marked *