If by accident you make a mistake in your sudoers file then you won’t be able to run sudo command after saving the file.
Following the answer here, you can simply run the command pkexec visudo, supply your password and provided you already had sudo permissions, fix the sudoers file, make sure that you save it using the Q when prompted, and you should be able to use sudo commands again.
When trying to use the
rvmsudo puppet apply --verbose manifests/site.pp
command in a aws instance to follow the instruction from ‘Deploying Rails’, the following error complains that the puppet command is not found, like:
sudo: puppet: command not found
After some searching and having a look at the blog post here and using the rvm notes in the aws instance and looking at this:
* On some systems (like Ubuntu) rvmsudo requires following changes to work properly:
It seems that for security reason the sudo command resets the path in the system.
You can actually see that this the case by running the command to display the path of the normal user:
aws$ echo 'echo $PATH' | sh
and the corresponding one for the sudo:
aws$ echo 'echo $PATH' | sudo sh
So a workaround to make it work is to add your group into the exemptions group in the visudo file, which means editing the visudo file:
and adding the group that your user you are working with belongs to:
Defaults exempt_group=name_of_your_group(or admin in some systems)