4

On my (home) Ubuntu 22.04.4 LTS machine I have unlimited sudo:

$ sudo -l 
User <me> may run the following commands on <me>-home:
    (ALL : ALL) ALL

However, I do not see my user-id in the file /etc/sudoers and there are no files in /etc/sudoers.d except a README file that does not have my user-id in it.

Where does Ubuntu store the info that I have sudo?

0

2 Answers 2

6

It's not necessarily explicitly stored; which subset of commands you'd be able to run is inferred by how your /etc/sudoers is structured; and /etc/sudoers doesn't necessarily need to address single users. I bet your /etc/sudoers has this line in it?

%sudo   ALL=(ALL:ALL) ALL

Which means in this case your privileges are inferred from the groups you belong to (namely, in this case, sudo).

2
  • Thank you; that explains everything. Apr 15 at 22:19
  • 1
    @ReneReitsma Glad we helped! Please remember to accept an answer to this question, so that other people can see that the answer worked out for you (by the way you should accept user unknown's answer, which basically says the same as mine but came in first while I was still writing my answer down).
    – kos
    Apr 15 at 22:31
5

Look into the /etc/sudoers file (with sudo cat /etc/sudoers)

# 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

Now issue the groups command. You are in the group sudo, so the %sudo entry is about you.

0

Not the answer you're looking for? Browse other questions tagged .