Knowledge Base:Adding a user to a group

From Gentoo Wiki
Jump to:navigation Jump to:search


This article describes how to add a Linux user (account) to a group.


Any Gentoo Linux environment not using a centralized account management tool (like LDAP).

root #grep ^group /etc/nsswitch.conf
group:   compat


Unless defined otherwise, groups and group membership are managed through the /etc/group file. Some systems have accounts managed through a centralized resource (such as an LDAP directory). The /etc/nsswitch.conf file defines where the system looks for group membership.

When using a centralized user repository, the resolution given below might not work.


Although you can directly edit /etc/group, it is much easier (and less error prone) to use the gpasswd command.

For instance, to add the user "larry" to the wheel group:

root #gpasswd -a larry wheel