Debian – How to add a user to a group

debiangroupraspbianusers

How do I add a user to a group.

This is on a system with no root password and only a single user pi with sudo privileges.

usermod seems to have been designed to make this as difficult as possible.

Best Answer

You can use usermod or edit the group file directly

# usermod -a -G ${group} ${user}

# vi /etc/group
...
wheel:x:10:root,user1,user2
...

Just remember group changes do not always propagate to active sessions. If you are changing a user who is currently logged in (including yourself), they must logout and login again for the change to take effect. (Under some circumstances a reboot may be required. Check id after logging in again to see if the new group is present.)

Related Question