Add user to sudoers again

Xen list at xenhideout.nl
Wed Apr 12 16:52:55 UTC 2017


Enrique Villalobos schreef op 12-04-2017 17:58:
> Hello,
> 
> I run this command:
> 
> sudo usermod -G www-data myuser
> 
> I forgot the "-a":
> 
> sudo usermod -a -G www-data myuser
> 
> Now myuser is not a sudoer so I can't add it to sudoers and I have no
> root password since I never needed it before.
> 
> Can it be fixed somehow?

Depending on what still works these days you can also:

in the Grub prompt, add "init=/bin/bash" to the kernel command line 
parameters (the line that also says quiet or splash or whatever, 
vmlinuz)

then the system boots but not much will work. You get a root prompt. You 
have to change the filesystem to read-write first:

# mount -o rw,remount /

Then you can simply run passwd for your root user

# passwd

After that you can reboot and login to root with the new password and 
fix it.

Regards.




More information about the ubuntu-users mailing list