Pages - Menu

Showing posts with label sudoers. Show all posts
Showing posts with label sudoers. Show all posts

Wednesday, April 24, 2013

Linux user not in the sudoers list anymore or forgot your password?

Crap, that happened to me too =/

I've installed VirtualBox and to use my USB devices I had to add my user to the virtualbox group so I did this:

usermod -G virtualbox gerep

My mistake? I forgot the -a or --append option that according to the manual:

Add the user to the supplementary group(s). Use only with the -G option.

The solution is simple, you need to boot on recovery mode (hold down the Shift key during bootup).

In the list that will show, choose the option revory mode.

In the next list, choose root - Drop to root shell prompt. You need to use your root password and doing this will open command line.

The filesystem is mounted as read-only, so you need to enter the following command to get it to remount as read-write, so the changes will be allowed:

mount -o rw, remount

Now I can change my user group with the same command usermod setting my user back to the sudo group but now with the -a option:

usermod -a -G sudo gerep
Now you can exit the command line, and select the option resume - Resume normal boot.

Note:
In case you forgot your user password do this and you'll be able to set a new password:

passwrd your_username