Skip to main content

Posts

Showing posts with the label User

Howto: Linux Add User To Group

H ow can I add a user to a group under Linux operating system? You can use the useradd or usermod commands to add a user to a group. The useradd command creates a new user or update default new user information. The usermod command modifies a user account i.e. it is useful to add user to existing group. There are two types of group. First is primary user group and other is secondary group. All user account related information is stored in  /etc/passwd ,  /etc/shadow  and  /etc/group  files to store user information. useradd Example - Add A New User To Secondary Group You need to the useradd command to add new users to existing group (or create a new group and then add user). If group does not exist, create it. The syntax is as follows: useradd -G { group-name }  username In this example, create a new user called vivek and add it to group called developers. First login as a root user (make sure group developers exists), enter: # grep developers /etc/group Output: developer