How To Restore Sudo Privileges To A Consumer In Ubuntu Linux

Get real time updates directly on you device, subscribe now.

This tutorial explains the best way to restore sudo privileges to a person from restoration mode on Ubuntu Linux and its derivatives like Linux mint, Pop OS working programs. I examined this information on Ubuntu 18.04 LTS system. Nonetheless, It ought to work on different Linux distributions as properly.


The opposite day I used to be testing the best way to add a daily person to sudo group and take away the given privileges to make him as a standard person once more on Ubuntu.

Whereas testing, I eliminated my administrative person from the ‘sudo’ group. As you already know, a person must be in sudo group to do any administrative duties. However, I had just one tremendous person and I already took out his sudo privileges.

Each time I run a command with sudo prefix, I encountered an error – “sk will not be within the sudoers file. This incident might be reported“.

I can not do any administrative duties. I could not swap to root person utilizing ‘sudo su’ command. As you already know already, root person is disabled by default in Ubuntu, so I can not log in as root person both.

Have you ever ever been in a scenario like this? No worries! Right this moment, I’ll present you the best way to repair damaged sudo privileges to a person on a Ubuntu  Linux system.

Restore sudo privileges

Step 1: Boot your Linux system into restoration mode.

To take action, restart your system and press and maintain the SHIFT key whereas booting. You will notice the grub boot menu. Select “Superior choices for Ubuntu” from the boot menu record.

Choose Advanced options for Ubuntu in Grub

Select “Superior choices for Ubuntu” in Grub menu

Within the subsequent display, select “restoration mode” choice and hit ENTER:

Choose recovery mode in Grub menu

Select restoration mode in Grub menu

Subsequent, select “Drop to root shell immediate” choice and hit ENTER key:

Choose drop to root shell prompt option

Select “Drop to root shell immediate” choice

You are now in restoration mode as root person.

Ubuntu recovery mode

Ubuntu restoration mode

Step 2: Mount root file system in learn/write mode. To take action, sort the next command to mount root (/) file system in learn/write mode.

mount -o remount,rw /

Step 3: Now, add the person that you simply faraway from the sudo group.

In my case, I’m including the person known as ‘sk’ to the sudo group utilizing the next command:

adduser sk sudo

Restore sudo privileges to a user from Ubuntu recovery mode

Restore sudo privileges to a person from Ubuntu restoration mode

Step 4: Then, sort exit to return again to the restoration menu. Choose Resume to start out your Ubuntu system.

Resume normal boot

Resume regular boot

Press ENTER to proceed to log-in regular mode:

Exit recovery mode in Ubuntu

Exit restoration mode in Ubuntu

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

To take action, sort the next command from the Terminal.

$ sudo -l -U sk

Pattern output:

[sudo] password for sk:
Matching Defaults entries for sk on ubuntuserver:
env_reset, mail_badpass,

Consumer sk might run the next instructions on ubuntuserver:

As you see within the above message, the person sk can now run all instructions with sudo prefix. Congratulations! You will have efficiently restored the sudo privileges to the person.

There are additionally different potentialities for inflicting damaged sudo

Please be aware that I really did this on function to indicate you the best way to restore damaged sudo privileges to a person. I eliminated myself from the sudo group and stuck the damaged sudo privileges as described above.

Do not do that in case you have just one sudo person. And, this technique will work solely on programs that you’ve bodily entry. Whether it is distant server or vps, it is rather tough to repair it. You would possibly require your internet hosting supplier’s assist.

Additionally, there are two different potentialities for inflicting damaged sudo.

The /and so on/sudoers file may need been altered.You or somebody may need modified the permission of /and so on/sudoers file.

Repair damaged sudo in Ubuntu

You probably have performed anyone or the entire above talked about issues and ended up with damaged sudo, attempt the next options.

Answer 1:

You probably have altered the contents of /and so on/sudoers file, go to the restoration mode as described earlier.

Backup the present /and so on/sudoers file earlier than making any adjustments.

cp /and so on/sudoers /and so on/sudoers.bak

Then, open /and so on/sudoers file:


Make the adjustments within the file to appear like this:

# This file MUST be edited with the ‘visudo’ command as root.
# Please contemplate including native content material in /and so on/sudoers.d/ as a substitute of
# immediately modifying this file.
# See the person web page for particulars on the best way to write a sudoers file.
Defaults env_reset
Defaults mail_badpass
Defaults secure_path=”/usr/native/sbin:/usr/native/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin”

# Host alias specification

# Consumer alias specification

# Cmnd alias specification

# Consumer privilege specification

# Members of the admin group might achieve root privileges
%admin ALL=(ALL) ALL

# Enable members of group sudo to execute any command

# See sudoers(5) for extra info on “#embrace” directives:

#includedir /and so on/sudoers.d

When you modified the contents to replicate like this, press CTRL+X and y to save lots of and shut the file.

Lastly, sort exit and choose Resume to start out your Ubuntu system to exit from the restoration mode and proceed booting as regular person.

Now, attempt to use run any command with sudo prefix to confirm if the sudo privileges are restored.

Answer 2:

In the event you modified the permission of the /and so on/sudoers file, this technique will repair the damaged sudo challenge.

From the restoration mode, run the next command to set the right permission to /and so on/sudoers file:

chmod 0440 /and so on/sudoers

When you set the right permission to the file, sort exit and choose Resume to start out your Ubuntu system in regular mode. Lastly, confirm in the event you can in a position to run any sudo command.


On this information, we’ve checked out what causes damaged sudo, and the best way to restore sudo privileges to a person from restoration mode in Ubuntu and its derivatives.

Comments are closed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More