User is not in the sudoers file. This incident will be reported, while working with Ubuntu
I could get this error and no other command its allowing me to execute.
Error as shown in image – 1
Image – 1
Solution:
Login to recovery mode (Click here – How to log in to recovery mode in Ubuntu)
And follow the steps to open Recovery Menu as this has tools which will help to recover the Operating system from error and as we have sudo error we can go and select root Drop to root shell prompt as shown in Image – 2
Image – 2
When you get terminal type below command to enable read write so that you can execute commands here
mount -o remount,rw /
To add the user in the sudoers file please do run below command
adduser username sudo
NB: here username is the current active user for which you are getting sudo error
let say machine user name is raj then command will be
adduser raj sudo
then you have successfully executed the command and run below command to exit
shutdown -r now
Now machine will reboot and then login with the same username having sudo error earlier.
Hopefully you will now be able to run sudo commands without any error.
You may also like:
Error while installing Microsoft Framework 3.5 service pack 1 in windows 8.1
How to log in to recovery mode in Ubuntu
How to install PHP7.1 and PHP 5.6 in Ubuntu 14
Product Review: Stellar Phoenix SQL Database Repair
#1805 – Column count of mysql.user is wrong expected 45 found 42. The table is probably corrupted
How to install nginx, mysql, phpmyadmin, php in Ubuntu