Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This question already has an answer here:

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?

share|improve this question

marked as duplicate by Eliah Kagan, Seth 2 days ago

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

up vote 7 down vote accepted

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.

share|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

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