1

I installed Ubuntu 22.10 desktop version on Oracle Vmware. I am unable to use the sudo command since I am not in the sudoers list. Solutions on the internet suggest entering the root mode using su command however I am unable to access root as well. All the other solutions need root access or being a sudo user. How should get into the sudoers list without either being a root user or having sudo access with another username.

Kindly help since I am stuck in this loop.

1 Answers1

1

Step 1: Boot your Linux system into recovery mode.

To do so, restart your system and press and hold the SHIFT key while booting. You will see the grub boot menu. Choose "Advanced options for Ubuntu" from the boot menu list. In the next screen, choose "recovery mode" option and hit ENTER. Next, choose "Drop to root shell prompt" option and hit ENTER key.

You're now in recovery mode as root user.

Step 2: Mount root file system in read/write mode. To do so, type the following command to mount root (/) file system in read/write mode.

$ mount -o remount,rw /

Step 3: Now, add the user that you removed from the sudo group.

In my case, I am adding the user called 'john' to the sudo group using the following command:

$ adduser john sudo

Step 4: Then, type exit to return back to the recovery menu. Select Resume to start your Ubuntu system.

Press ENTER to continue to log-in normal mode.

Step 5: Now check if the sudo privileges have been restored.

$ sudo -l -U sk

Ankit
  • 11