How to Fix “User is not sudoers file” Linux Desktop

Recently I installed Debian 12 desktop in my system and tried to use the terminal and execute the “root” command getting the “user is not sudoers file.” error. So, after a while, I figured out the issue, and in this tutorial, I have explained how you can fix the problem if you are facing the same.

User is not sudoers file error Linux Debian
Getting error while trying to execute root user command

I have recently installed Debian 12 in VirtualBox, to test things out, but when I try to update the system or install a package, got an error stating “user is not sudoers file.” After researching online forums, found a simple solution, which I have described here step-by-step.

Step – 1. Reboot to Advanced options for GNU/Linux

Advanced Options for Linux - Debian
Advanced options in GNU GRUB

When you reboot your system, you will see the image shown above. Since we have to go into recovery mode, so need to select the “Advanced options for Debian GNU/Linux”, If you are using a different distro, then the process might be slightly different, or the visual will be different. So not to worry, just select the advanced option quickly, because in a few seconds, the system automatically boots with the default order.

Linux Recovery Mode - Debian
Recovery Mode option in GNU GRUB

When you choose advanced options then you must select the recovery mode option as shown in the image above, “Debian GNU/Linux, with Linux 6.1.0-10-amd64 (recovery mode)”, when you choose the option, you will be entered in the recovery mode.

Must Read:

Step – 2. Add User to sudoers file.

Enter Root Password - Recovery Mode
Enter the root user password to enter Recovery mode

When we select the recovery mode, the first time need to enter the root user password, which is we have already created during the OS installation process. (If you don’t have the root access then you contact your system administrator for the access.)

Add user in sudoer file - Recovery Mode Linux
Add user in sudoer file

Now, need to add the user in the sudoers file using the following command:

adduser pronay sudo

Here in this command, I have used my name “pronay”, but in your case, you have to add your system username. After adding the system user to the sudoers file, reboot the system and open the terminal, and check using the sudo -i command, whether it is working or not.

Login as Root - Linux Operating System - Debian
After fixing the error

Conclusion

This was the two steps solution for fixing the “user is not sudoers file” in the Linux desktop, simply you have to boot in recovery mode and need to add the user to the sudoers list. In my case the error was caused, when I installed Debian as a fresh operating system, if you have a multi-user system and your profile shows this error then you must edit the sudoer file by booting recovery mode, here is the forum discussion about Fixing Linux Root login issues. By the way, if following this method your problem got fixed, please share your experience and if you are still facing the error, please comment. I will try to help out. Thanks 🤓


Pronay Sarkar

Hello!
I am Pronay Sarkar, I love to write about tech and stuff.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.