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.
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
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.
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.
- Get Microsoft Office 365 for Free with 25 User Licenses
- Upgrade PHP 8.2 from PHP 8.1.x or Older Version
Step – 2. Add User to sudoers file.
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.)
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.
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 🤓