0

I'm using Red Hat Enterprise Linux Server release 7.7 (Maipo). I created a new user with

useradd igwuser

I added it to wheel group using the command

usermod -g wheel igwuser

Now I can perform operations with sudo for igwuser. Problem I'm facing is, still igwuser is not shown in wheel group.

$ grep wheel /etc/group
wheel:x:10:secadmin

What can be the reason?

1 Answer 1

4

You have given the igwuser user wheel as their primary login group. The /etc/group database only lists secondary group memberships.

If you now do getent passwd igwuser, you will see wheel listed as their login group (the fourth :-delimited field will be the GID of wheel, probably 0).

To add the user to the wheel group in such a way that it is a secondary group for the user, you should have used

usermod -a -G wheel igwuser

This appends (-a) the wheel group to the secondary groups of the user.

See also man usermod on your system.

You could also have added the user to wheel with the useradd command at the same time as you created the user:

useradd ...options... -G wheel igwuser

See man useradd on your system.

1
  • You may also add the user igwuserto the group wheel using gpasswd -a igwuser wheel.
    – Bananguin
    Apr 7, 2020 at 8:55

You must log in to answer this question.

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