I am using Ubuntu 18.04. I accidentally removed the sudo group. Is there any way to recover from this? I still have access to the root account. I tried to add the sudo group again with the root user, but this did not work, and I got an errorcode 10.

  • 1
    If you have the 'root' account enabled (with its own password), you can login with root & correct. If you don't, probably the easiest way to fix is using a 'live' environment (eg. install media), and make the change that way... – guiverc Jul 27 '18 at 9:34
  • 1
    I have acess to the root account. But I have no idea how to recreate the sudo group. Mayby you cann explain that a littlebit more – Max Jul 27 '18 at 9:36
  • What exactly did you try, and what was the complete text of the error? If you attempted to recreate the group from the recovery shell, did you remember to remount the filesystem in read-write mode first? – steeldriver Jul 27 '18 at 9:48
  • I tried addgroup sudo the erros are: /etc/ group / could not be locked; try again later and addgroup: /user/sbin/groupadd -g 1002 sudo: returned errorcode 10 – Max Jul 27 '18 at 9:52

This link helped me, then adding the sudo group with sudo addgroup sudo and adding my user to group with sudo adduser -aG username sudo worked.

  1. Reboot the computer. If Ubuntu is your primary and the only operating system in your computer, press the Shift button when it is booting up. This should make the GRUB screen show up on your monitor. On the GRUB screen, press the down keyboard key to the Recovery mode and press Enter.

    ![enter image description here
    Ubuntu GRUB screen

  2. On the next screen, select Check all file system (will exit read only mode).

    ![enter image description here

    When you see the message Finished, press Enter, press Enter.

  3. Next, select Drop to root shell prompt.


  4. You will now be at the command line. Type:

    usermod -a -G admin username

    Replace the username with your own login user name.

  5. That’s it. Now type exit and select Resume normal boot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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