15

My boss want his team members to let him know, who has root access.

How do I check if I have root access?

If I can login on a server and do anything with sudo, does it mean I have root access?

  • 4
    Simple answer: Yes. – Stephen Harris Aug 24 '16 at 17:05
  • If you can do anything with sudo, you're either in the wheel group or your user has a specific entry in sudoers. If you can only do some things with sudo, that means there's some careful sudoers settings going on. – polemon Aug 24 '16 at 17:45
17

Yes. If you are able to use sudo to run any command (for example passwd to change the root password), you definitely have root access.

If you, for example, run sudo -s and it gives you a shell, you may issue the id command. It will respond with something like

uid=0(root) gid=0(root) groups=0(root)

A UID of 0 (zero) means "root", always.

Your boss would be happy to have a list of the users listed in the /etc/sudores file. If there are groups listen in there, he would probably want to know who the members of those groups are.

For example, if the system has a sudo (and/or admin/wheel) group which is listed in the sudoers file like

%sudo   ALL=(ALL:ALL) ALL

this gives free range to any member of the group to use sudo without restriction. This is how you get all the usernames of that group:

$ grep '^sudo' /etc/group

Alternatively

$ getent group sudo

on systems using LDAP or NIS/YP, or some other directory service.

  • -rwsr-xr-x /usr/bin/passwd and others are special: they got the s-bit. So all programs with the s can potentially be run by anybody. – hschou Aug 24 '16 at 20:23
  • In addition to the groups sudo and admin, the wheel group has traditionally be used to list users with root-access. On some (non-linux) systems, the root group - or the group with GID = 0 - has also been used. – Baard Kopperud Aug 24 '16 at 23:42
  • @hschou Yes, but you can't change the password for root without knowing the old password, unless you are root already. That's what I meant. – Kusalananda Aug 25 '16 at 12:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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