In a fresh Debian Linux installation, When you run the sudo command, then you get this error. In this quick blog, I will show you how to resolve this issue.
Why Username is not in the sudoers file error occurs
Before showing you the solution, it is beneficial for you to know about what is the reason this error occurs.
When you freshly install Debian Linux in your system, there is a screen where you have to create a new user.
After installation, when you logged in with that user, the Username is not in the sudoers file error is reported. This is primarily because, when Debian created the user, it doesn’t put the created user into the
This is the opposite behavior in comparison to Ubuntu or Fedora. In Ubuntu, the user is by default added to the
sudo group, that’s why you don’t face any error like this.
Solve Username is not in the sudoers file
First, check what groups your user has access to. In the command, replace the
username with your original username.
If you don’t find
sudo in the output, then you have to add your user to the
- Switch to the root user using the following command and put your root password.
- Run the following command to add the username to the
sudogroup.Replace the username with your username.
sudo usermod -a -G sudo username
- Now exit the terminal and restart the device.
exit && sudo reboot
After following all the above steps one by one, the Username is not in the sudoers file error should be gone.
Sudo command does not exist
Sometimes, when you make a server install, the sudo command is not installed by default. To install sudo, run the following command.
sudo apt update sudo apt install sudo
- How to Install Davinci Resolve in Debian Linux
- Solve Gnome Boxes Virtualization Settings Are Unavailable on Your System
- Install and Configure Linux Virtual Machine Using Virt-Manager
- Install Jellyfin on PopOS, mint, and other Ubuntu derivatives
- Solve error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp 184.108.40.206:443: connect: network is unreachable