I have a user, supersecretuser, that is in the sudo group, but doesn't have sudo access. Is there something else that needs to be done to give this user sudo access?
$ ssh supersecretuser@myserver
supersecretuser@myserver:~$ groups
supersecretuser adm cdrom sudo dip plugdev lpadmin sambashare
supersecretuser@myserver:~$ sudo vim install.sh
[sudo] password for supersecretuser:
supersecretuser is not in the sudoers file. This incident will be reported.supersecretuser is the user we setup when doing the Ubuntu install.
4 Answers
Since you error message says your user is not in the sudoers file, could you please check your /etc/sudoers file, see if there is such a line:
%sudo ALL=(ALL:ALL) ALLIf this line is missing, users in the sudo group will not be sudoers. Edit the file using visudo command (checks for correct synthax and locks the file).
You can also try to add a customized line like this:
root ALL=(ALL:ALL) ALLReplace root with your username, reboot, and try if it works.
As per your conversation with @steeldriver in the comments, my guess is that your user isn't logged off.
The easiest way to make sure that the supersecretuser has logged off is to type into terminal, as another user, who.
When doing so, I get output like this:
mitch@quartz:~$ who
mitch :0 2014-09-08 09:49 (:0)
mitch pts/0 2014-09-08 13:18 (:0.0)I only see myself. Similarly, typing w into a terminal shows me who all is logged on and what they're doing:
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
mitch :0 :0 09:49 ?xdm? 29:08 0.11s init --user
mitch pts/0 :0.0 13:18 5.00s 0.06s 0.01s wYou can STOP your other user, (SSU I'll call it) with the following command:
pkill -STOP -u SSUHowever, truthfully, the easiest solution would be to just reboot the system if that's possible.
6The easiest way to add a supersecretuser to sudo group is sudo gpasswd -a supersecretuser sudo and have supersecretuser log out/back in; but if you have lost the ability to sudo, I'm afraid you'll have to reinstall.
After you have checked that file privileges are right:
-r--r----- 1 root root x x x x:x /etc/sudoersYou most probably have lost the s-bit on file executable, it should read:
-rwsr-xr-x 2 root root x x x x /usr/bin/sudoif it doesn't: with root privileges give `
chmod u+s /usr/bin/sudoand you
should be okay.. unless you know you have altered the sudoers file yourself! :)