So there are a lot of articles with this error but none of them actually helped me solve my problem. I have a VPS with GoDaddy so I’m not sure if I have a more less unique case here but I just thought I’d detail out my resolution for someone else that might be having this issue.
I’m using CentOS 6.1
The problem started when I was trying to renew my LetsEncrypt certificate which requires a user with sufficient privileges so the sudo command has to be used. After issuing the command I was greeted with the following username is not in the sudoers file. This incident will be reported.
My initial reaction to this was to try and switch to the root user so that I could have a look at the sudoers file.
So I tried to issue the su command.
I was greeted with the following:
-bash: /bin/su: Permission denied
Ok, so I immediately thought lets add sudo su because obviously su needs to run with elevated permissions but here’s the problem. The user account, the only one other than the root account was not in the sudoers file so I was stuck…
Luckily, when you get one of these server setup via GoDaddy, WHM is installed which by default includes Terminal which by default connects to a terminal session using the root user.
Using the Terminal application from within WHM allowed me to run as root.
So from there it was as easy as creating a file in the /etc/sudoers.d/ folder.
You would just create a file and name it the same as the username and then add the following content to the file
[simterm]username ALL=(ALL) NOPASSWD: ALL[/simterm]
You’ll then need to log out and back in as that user. That’s it. Questions can go in the comments section.