I have one admin account and recently I have accidentally added myself to a single group (usermod -G without -a).

So, I am not in the sudoers file any more. However, it is not possible to log in to root by default on Ubuntu. Do I reset the password for root during the boot process?


No need to reset root password (well, technically, Ubuntu's root does not even have a password). Do this:

  • Reboot your PC
  • In Grub's OS selection screen, choose "Ubuntu xxxx - recovery mode"
  • Now you have a console with root privileges. Add your user back to sudo group:

    usermod -a -G sudo youruser

    The shell might reply that it cannot do it because the file system in mounted in read-only. To remount your fs in read-write: mount -o remount,rw /

  • That will be enough for sudo. But its suggested you also re-add yourself to other default administrative groups. You can reboot, logon normally and use GUI:

Menu > Administration > Users and Groups > Advanced Settings > User Privileges or Account Type (Change...) > Administrative

  • Or use this command:

    sudo usermod -a -G adm,cdrom,plugdev,fuse,lpadmin,sambashare youruser

Note: The 'sudo' group used to be the 'admin' group prior to Precise Pangolin. If you're on anything older, replace the group 'sudo' with the group 'admin' in the above commands.

| improve this answer | |
  • That's what I figured out myself. Thanks anyways :) – m33lky Aug 31 '11 at 5:49
  • 1
    Glad you found out. And hope you didnt "reset" root's password while trying. In Ubuntu root is a disabled account (=no password), for a good reason. Keep it that way. You will still be able to use sudo, sudo su, recovery mode, etc. Disabling root's password only mean you can not login as root in a login shell, which is a very good security measure. – MestreLion Aug 31 '11 at 5:57
  • Hypothetically ... What if one had disabled GRUB recovery mode by uncommenting GRUB_DISABLE_RECOVERY="true" in /etc/default/grub. What would one do? – daka May 26 '16 at 22:18
  • 1
    @sudoman: boot using a CD/USB live session, mount the original root partition, edit its /etc/default/grub(or directly the config files at /boot/grub) and update/reinstall grub. Basically the same procedures as if you had lost grub as the boot manager (when installing windows, for example) – MestreLion Jun 1 '16 at 10:05

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