Linux – recovery of password for root in Ubuntu 12.10

administratorlinuxpasswordsrootUbuntu

I installed Ubuntu 12.10 on my 32-bit machine using Ubuntu installer and gave a password(and the account name was 'samsung') when prompted. Later I was able to use that password for logging in, locking-unlocking, authentication etc.(I guess that's because I was the administrator then). But now,I have changed the account type from "administrator" to "standard" by mistake and whenever it needs to authenticate during any process(like connecting to a wi-fi,unlocking my user account), it asks me to give the password for root, but unfortunately the same password is not working. Tasks other than authentication(like loging in etc.) is working fine. I have changed the password several times but with no solution. If I use 'sudo' in terminal,it says "samsung is not in the sudoers file. This incident will be reported." How can I regain control?

Best Answer

Ubuntu, by default, has no password for the user root.

If you locked yourself out of your system,

  1. select "recovery mode" in the grub boot menu, when starting your machine. If you don't see a boot menu, you may need to press Shift during a time window of a few seconds after BIOS stage.

    This gives you root access and the power to grant your regular user account its administrative privileges.

  2. Enable write access on /¹.

    mount -o remount,rw /
    
  3. Add admin to the groups of your account.

    usermod -a -G admin [account name]
    
  4. Reboot and everything should be back to normal.

¹ I'm not sure whether the recovery mode of Ubuntu 12.10 mounts the root file system or just the initramfs.

Related Question