This is an article which inform how to reset the file sudoers which is located in etc folder. In other means, this article will inform how to edit file in /etc/sudoers without having to edit it. This case is also effective for a condition which is not allowing to execute the ‘visudo’ command to be executed and furthermore edit file sudoers located in etc folder or the /etc/sudoers file.
Normally, editing file /etc/sudoers or executing the ‘visudo’ command will allow and enable any user to be added in order for an example having a security privilege of another user such as ‘root’. The information about this case can be retrieved by reading the article titled ‘Cannot switch to root because username is not in the sudoers file Ubuntu’ in this link.
Whenever this case is happening, for being unable to execute the ‘visudo’ command since it is required to have to be included in the file /etc/sudoers and since editing the file itself another way to do it is by executing the ‘visudo’ command, there is another way to do and solve this problem. The steps below is the way to do it :
1. Restart the laptop or PC.
2. In the boot screen, type ‘Esc’ character which is working in Ubuntu Linux operating system distribution or any character on the keyboard which will trigger on displaying the Boot Screen Loader. In this context is GRUB Boot Loader.
3. Edit the parameter in the GRUB Boot Screen Loader by selecting one line of boot execution by typing ‘e’ to do it.
4. Look the entry which begins with kernel …. or linux …. and add in the end of the line the keyword : rw init=/bin/bash
5. Press enter to finish editing the GRUB Boot Loader
6. Press b to boot the system so that the edited entry of GRUB Boot Loader will be booted with the additional parameter defined in the 4th step.
7. It will then direct to the unusual display of operating system which is a root shell activated without having to insert any password. In this case, the special privilege which is editing ‘/etc/sudoers’ or executing ‘visudo’ command.
8. Add the line in the ‘/etc/sudoers’ specifying user which is going to be used to run special privilege utility or command that ‘root’ owns. And the rest of the steps is specified in the article ‘Cannot switch to root because username is not in the sudoers file Ubuntu’ in this link.