TL;DR
I log in to a server testserver
with my account testuser
and I am able to perform a sudo -s
because I am in the sysadm
group.
When I query groups I get the sysadm
group, but when I query the group directly with cat /etc/group
or getent group sysadm
my login is not listed in that group.
Why?
Long version
I have a user account testuser
that I can use to login via putty (SSH) to a terminal session on a server (Ubuntu 14.04) called testserver
.
When I run the groups
command I get the following output for my account:
sysadm
Ok, so I should be in the sysadm group. I then list the sysadm group members:
getent group sysadm
...which produces the following result:
sysadm:x:800:
At this point I am slightly confused. I (testuser) am in the group and again I'm (visually) not in that group, because there are no entries at the end of the groups output.
I took a look at the sudoer configuration with visudo. I have the following configuration:
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a 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
%sysadm 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
That's all there is in that file.
Summary
- I have found out that I am in the
sysadm
group - The
sysadm
group does not contain any members - I can
sudo -s
and then do whatever I want to
Questions
- How can I retrieve information from the system which will tell me why I am in the sysadm group?
- Are there any other configuration settings that will put my login in a group, that I am currently not aware of?
a) Active Directory
b) Policies
c) ...
I have read the following articles so far, but none of them helped me find out why I am in the sysadm group but (visually) not in that group.
- How can I view what groups a user is in?
- Implications of manually adding a user to the staff group
- How do I list the members of a group?
- Understanding Group Permissions
- Change in sudoers does not take effect. Ubuntu 16.10 fresh install + one line.
- General posts containing "group members" (askUbuntu Search)
/etc/passwd
put you in group 800 at login?getent passwd $USER | cut -d: -f4
will show you your login group. How did you (or whoever) create thetestuser
account? – waltinator Mar 08 '17 at 15:03800
back. So your comment is the answer to my question. This means that there is a default group for each user and this happens to be in my case the groupid of thesysadm
group. Could you please post as response so that I can mark it as the correct answer. – John K. N. Mar 08 '17 at 15:12