If you try to use sudo to run commands with root privileges in Ubuntu Linux and you get the following error message:
username is not in the sudoers file. This incident will be reported.
then you must boot in Recovery mode and either add the username to admin group (which is allowed to use sudo) or edit the config file by running:
and add the following line:
username ALL=(ALL) ALL
where username is your username you want to allow to run sudo.
Let’s say you’ve entered in Recovery mode and you want to make changes to your config files (for example you want to add a new user or you want to change network config) but your root partition is mounted read only. To mount it read write run:
mount -o remount,rw /