I am running a Ubuntu 12.04 LTS server. Today I have been doing some maintenance to the server, and a security audit.

I realized that sudo is not working the way I expected it to. In the default sudoers file (visudo) it says that members of the group admin is able to gain root privileges and members of the group sudo is able to sudo.

My own user is only member of my users default group, but is still able to both sudo and use su.

What an I missing?

This is my sudoers file:

Defaults        env_reset
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

closed as off-topic by steeldriver, jasonwryan, Gilles, Anthon, jimmij Dec 19 '14 at 22:54

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – steeldriver, jasonwryan, Gilles, Anthon, jimmij
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Are you sure you aren't in the sudo or admin group? Maybe there is something in /etc/sudoers.d? – jw013 Dec 19 '14 at 15:16
  • username@host:~$ id username uid=1003(username) gid=1003(username) groups=1003(username) – TheG Dec 19 '14 at 15:18
  • ll /etc/sudoers.d total 12 drwxr-xr-x 2 root root 4096 Apr 10 2014 ./ drwxr-xr-x 107 root root 4096 Dec 19 16:17 ../ -r--r----- 1 root root 753 Feb 27 2013 README – TheG Dec 19 '14 at 15:18
  • Is there anything in the /etc/sudoers.d/ directory? – Andy Dec 19 '14 at 15:41
  • Which sudo is being invoked? I've ran into issues before where someone installed a newer version from source and it was using the one installed in /usr/local which uses a different sudoers file. – Bratchley Dec 19 '14 at 15:43

It seems that, for some mysterious reason, restarting openssh made the trick....

  • 1
    Had you maybe just removed the user you were testing with from the sudo or admin group? Group membership changes are applied when you log in, they have no effect on already-started sessions. – Gilles Dec 19 '14 at 19:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.