Few days before I installed debian on my laptop. It was recommended by one of my friends otherwise I have been using Ubuntu or Elementary. But Debian is more raw than any of those. But yeah, I installed it and pretty straight forward I jumped to terminal.
But the heck I get an error : sans<my username> is not in the sudoers file. This incident will be reported. Regardless of any clue, I opened Internet but unfortunately found nothing working. I thought of re-installing the OS, but I received a quote from a friend – Its linux, not windows. There must be some solution.
So, here I am writing the blog to help you guys how to overcome this problem :
- First open up your terminal.
Type in su and press [Enter] . Enter your root password.
The command prompt now should look like this.(sans is my username, it will display your username for your part).
2. Now, we need to install sudo. Type : apt-get install sudo and press [Enter].
3. Now add username(sans) to the sudo : adduser sans<your username> sudo and press [Enter].
Going pretty good till now. Relax your fingers for a bit. We are almost over.
4. Now, we need to add our name to /etc/sudoers file. Type : nano /etc/sudoers press [Enter]. You will get a screen like this.
Scroll down and look for the line “%sudo ALL=(ALL:ALL) ALL”. Below that add a line :
sans<your username> ALL=(ALL:ALL) ALL.
You can see I have already added the line in the screenshot.
5. Now, Press “Ctrl+x” then press “y” and then press [Enter] to exit and save the file.
6. Exit from the terminal. And open again to check if sudo is installed or not.
Type : sudo ls.
If you get: sans<your username> is not in the sudoers file. This incident will be reported. Then you need to follow the steps again.
Else : Desktop Documents Downloads Music Pictures Public Templates Videos
Then congratulation, your sudo is now installed.